public async Task <IHttpActionResult> Create(SlideShowNewDTO slideShow) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(await repository.Create(slideShow))); } catch (HttpException ex) { return(BadRequest(ex.Message)); } }
//TODO : need to handle update event; delete / add new images //-> Create public async Task <SlideShowListDTO> Create(SlideShowNewDTO newDTO) { using (var transaction = db.Database.BeginTransaction()) { try { List <sm_doc> documents = await Helper.Helper.SaveUploadImage(db, Helper.Helper.slideShowDocumentName, Helper.Helper.document_SlideShowTableID, Helper.Helper.slideShow_RecordID, newDTO.images);// tmp not useful , just reserve data for using in the furture transaction.Commit(); return(await SelectByID(Helper.Helper.slideShow_RecordID)); } catch (Exception ex) { transaction.Rollback(); throw new Exception(ex.Message); } } }