private bool DoCreateProject(ProjectViewModel model) { var svc = new ProjectAppSvcGeneric(); var created = svc.Create(model.GetEntity()); return(created.Id > 0); }
public void CreateTest() { var objProject = new Project { ProjectName = "Lixo para teste", StartDate = DateTime.Now, IsActive = true, CustomerId = 1 }; var svc = new ProjectAppSvcGeneric(); var result = svc.Create(objProject); Assert.IsNotNull(result); Assert.IsTrue(result.Id > 0); }
public IHttpActionResult Create(ProjectViewModel model) { if ( string.IsNullOrEmpty(model.projectName) || (model.customerId <= 0) ) { return(BadRequest()); } try { var svc = new ProjectAppSvcGeneric(); var newProject = svc.Create(model.GetProject()); return(Ok(newProject)); } catch (Exception e) { return(InternalServerError(e)); } }