BExIS.Dlm.Services.Administration.ResearchPlanManager.Update C# (CSharp) Method

Update() public method

public Update ( ResearchPlan entity ) : ResearchPlan
entity ResearchPlan
return ResearchPlan
        public ResearchPlan Update(ResearchPlan entity)
        {
            Contract.Requires(entity != null, "provided entity can not be null");
            Contract.Requires(entity.Id >= 0, "provided entity must have a permanent ID");

            Contract.Ensures(Contract.Result<ResearchPlan>() != null && Contract.Result<ResearchPlan>().Id >= 0, "No entity is persisted!");

            using (IUnitOfWork uow = this.GetUnitOfWork())
            {
                IRepository<ResearchPlan> repo = uow.GetRepository<ResearchPlan>();
                repo.Put(entity); // Merge is required here!!!!
                uow.Commit();
            }
            return (entity);
        }