public void Update(string userId, ProgrammerDTO programmerDTO) { if (programmerDTO == null) { throw new ValidationException("No information about this programmer. Try some more", "Id"); } if (userId == null) { throw new ValidationException("Programmer and User Id does not match", "Id"); } DataBase.Programmers.Update(Mapper.Map <ProgrammerDTO, Programmer>(programmerDTO)); DataBase.Save(); }
public System.Web.Mvc.ActionResult MakeOrder(int?id) { try { ProgrammerDTO worker = projectService.GetProgrammer(id); var project = new ProjectViewModel { ProgrammerId = worker.Id }; return(View(project)); } catch (ValidationException ex) { return(Content(ex.Message)); } }
public IHttpActionResult GetProgrammer(string userId) { ProgrammerDTO programmer = null; try { programmer = _programmerService.Get(userId); } catch (ValidationException) { return(NotFound()); } catch (Exception) { InternalServerError(); } return(Ok(Mapper.Map <ProgrammerDTO, ProgrammerModel>(programmer))); }