public ApiResponseModel UpdateGalleryType(GalleryTypeModel galleryTypeModel) { ApiResponseModel apiResponseModel = new ApiResponseModel { Message = "Updated", MessageType = ApiResponseMessageType.success }; if (galleryTypeModel != null) { var _oldData = _db.MstGalleryType.Where(x => x.GalleryTypeId.Equals(galleryTypeModel.GalleryTypeId) && x.IsActive).FirstOrDefault(); if (_oldData != null) { _oldData.BaseUrl = galleryTypeModel.BaseUrl; _oldData.GridSize = galleryTypeModel.GridSize; _oldData.GalleryType = galleryTypeModel.GalleryType; _oldData.ModifiedDate = DateTime.Now; _oldData.ModifiedBy = galleryTypeModel.UserId; _db.Entry(_oldData).State = EntityState.Modified; if (_db.SaveChanges() < 1) { apiResponseModel.Message = "Unable to update."; apiResponseModel.MessageType = ApiResponseMessageType.error; } } } else { apiResponseModel.Message = "Unable to find record"; apiResponseModel.MessageType = ApiResponseMessageType.warning; } return(apiResponseModel); }
public ApiResponseModel SaveGalleryType(GalleryTypeModel galleryTypeModel) { ApiResponseModel apiResponseModel = new ApiResponseModel(); apiResponseModel.Message = "Saved"; if (galleryTypeModel != null) { MstGalleryType mstGalleryType = new MstGalleryType() { BaseUrl = galleryTypeModel.BaseUrl, CreatedDate = DateTime.Now, GalleryType = galleryTypeModel.GalleryType, GridSize = galleryTypeModel.GridSize, IsActive = true, CreatedBy = galleryTypeModel.UserId }; _db.MstGalleryType.Add(mstGalleryType); if (_db.SaveChanges() < 1) { apiResponseModel.Message = "Unable to save."; } } return(apiResponseModel); }
public JsonResult DeleteGalleryType([FromBody] GalleryTypeModel galleryTypeModel) { return(Json(galleryManagementDetails.DeleteGalleryType(galleryTypeModel))); }