public IHttpActionResult Post([FromBody] PresenterDto presenter) { try { if (presenter != null) { return(Ok(personBLL.CreateNewPerson(presenter))); } else { return(BadRequest()); } } catch (Exception e) { // LOG ERROR return(InternalServerError(e)); } }
public Guid SavePresenter(IPresenter presenter) { using (var db = new RtDataContext(_connectionString)) { var dto = db.Presenters.FirstOrDefault(p => p.PresenterId == presenter.PresenterId); if (dto == null) { dto = new PresenterDto() { PresenterId = Guid.NewGuid() }; db.Presenters.InsertOnSubmit(dto); } dto.FirstName = presenter.FirstName; dto.LastName = presenter.LastName; db.SubmitChanges(); return(dto.PresenterId); } }