public IHttpActionResult SaveBlog(BlogViewModel model) { model.CreatedBy = User.Identity.GetUserId <long>(); var blogId = _blogService.BlogInsert(model.ToModel()); var fileGroupsItem = model.FileGroupItem != null?model.FileGroupItem.ToModel() : null; if (fileGroupsItem != null) { //set target path and move file from target location fileGroupsItem = _fileGroupService.SetPathAndMoveSingleFile(fileGroupsItem, blogId); //Save list of file in our DB _fileGroupService.FileGroupItemsInsert(fileGroupsItem); } return(Ok(blogId.SuccessResponse("Blog save successfully"))); }
public long DummyTableForFileInsert(DummyTableForFileModel model) { var id = _dummyFileUploadDBService.DummyTableForFileInsert(model); if (model.FileGroupItems != null) { //set target path and move file from target location model.FileGroupItems = _fileGroupService.SetPathAndMoveFile(model.FileGroupItems, id); //Save list of file in our DB _fileGroupService.FileGroupItemsInsertXml(model.CreatedBy, id, model.FileGroupItems.XmlSerialize()); } if (model.FileGroupItem != null) { //set target path and move file from target location model.FileGroupItem = _fileGroupService.SetPathAndMoveSingleFile(model.FileGroupItem, id); //Save list of file in our DB _fileGroupService.FileGroupItemsInsert(model.FileGroupItem); } return(id); }