public Project PutProject(Project project) { Project proj = Projects.Where(x => x.ProjectID == project.ProjectID).FirstOrDefault(); if (proj != null) { proj.UpdatedDate = DateTime.Now; //proj.CompanyId = objCust.CompanyId; proj.ProjectName = project.ProjectName; proj.Discription = project.Discription; //proj.CompanyId = project.CompanyId; proj.Budget = project.Budget; proj.StartDate = project.StartDate; proj.EndDate = project.EndDate; proj.ApproverEmail = project.ApproverEmail; proj.ConsultantRate = project.ConsultantRate; proj.EmpRate = project.EmpRate; proj.CustomerId = project.CustomerId; proj.ApproverName = project.ApproverName; proj.CreatedBy = project.CreatedBy; //proj.CreatedDate = objCust.CreatedDate; proj.UpdateBy = project.UpdateBy; Projects.Attach(proj); this.Entry(proj).State = EntityState.Modified; this.SaveChanges(); return(proj); } else { return(null); } }