private bool DoUpdateProject(ProjectViewModel model) { var svc = new ProjectAppSvcGeneric(); var updated = svc.Update(model.GetEntity()); return(updated != null); }
public IHttpActionResult Patch(ProjectViewModel model) { if (model.id < 0) { return(BadRequest()); } var svc = new ProjectAppSvcGeneric(); var toUpdate = svc.Get(model.id.Value); if (toUpdate == null) { return(NotFound()); } try { toUpdate.ProjectName = model.projectName; var result = svc.Update(toUpdate); return(Ok(result)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public void UpdateTest() { var objCustomer = new Project() { Id = 1, ProjectName = "Fusca Voador Falante com farol de raio lazer e bazuca" }; var svc = new ProjectAppSvcGeneric(); var projectUpdated = svc.Update(objCustomer); Assert.IsNotNull(projectUpdated); Assert.IsTrue(projectUpdated.Id > 0); }