public HttpResponseMessage Post(ProspectCreateViewModel model) { if (ModelState.IsValid) { var item = _service.Execute(model.ToCommand()); return(Accepted(new { created = item.RowsAffected, errors = item.Errors })); } return(Bad(ModelState)); }
public static ProspectCreateCommand ToCommand(this ProspectCreateViewModel model) { return(new ProspectCreateCommand() { ProspectID = Guid.NewGuid(), ProspectName = model.ProspectName, ProspectType = model.ProspectType, Closed = model.Closed, AdditionalInfo = model.AdditionalInfo }); }