Esempio n. 1
0
 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));
     }
 }
Esempio n. 2
0
        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);
            }
        }