public ActionResult DeleteItemCategory(int CategoryId) { ItemCategoryDal itemCategoryDal = new ItemCategoryDal(); int i = itemCategoryDal.DeleteItemCategory(CategoryId); return(Json(i, JsonRequestBehavior.AllowGet)); }
public ActionResult GetItemCategoryByGroupId(int GroupId) { ItemCategoryDal itemCategoryDal = new ItemCategoryDal(); List <ItemCategoryDto> lstItemCategoryDto = itemCategoryDal.GetItemCategoryByGroupId(GroupId); return(Json(lstItemCategoryDto, JsonRequestBehavior.AllowGet)); }
public ActionResult GetAllItemCategory() { ItemCategoryDal itemCategoryDal = new ItemCategoryDal(); List <ItemCategoryDto> lstItemCategoryDto = itemCategoryDal.GetAndEditItemCategory(0, 1); return(Json(lstItemCategoryDto, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveItemCategory() { try { ItemCategoryDal itemCategoryDal = new ItemCategoryDal(); ItemCategoryDto itemCategoryDto = new ItemCategoryDto(); itemCategoryDto.CategoryId = Convert.ToInt32(System.Web.HttpContext.Current.Request["CategoryId"] == "" ? "0" : System.Web.HttpContext.Current.Request["CategoryId"]); string Message, fileName, actualFileName; Message = fileName = actualFileName = string.Empty; if (Request.Files.Count > 0) { var fileContent = Request.Files[0]; if (fileContent != null && fileContent.ContentLength > 0) { actualFileName = fileContent.FileName; fileName = Guid.NewGuid() + Path.GetExtension(fileContent.FileName); itemCategoryDto.CategoryImage = fileName; } fileContent.SaveAs(Path.Combine(Server.MapPath("~/UploadImages/"), fileName)); } else { fileName = ""; if (itemCategoryDto.CategoryId > 0) { dynamic imgFile = itemCategoryDal.GetAndEditItemCategory(itemCategoryDto.CategoryId, 1); itemCategoryDto.CategoryImage = Convert.ToString(imgFile[0].CategoryImage); } else { itemCategoryDto.CategoryImage = fileName; } } itemCategoryDto.GroupId = Convert.ToInt32(System.Web.HttpContext.Current.Request["GroupId"]); itemCategoryDto.CategoryName = System.Web.HttpContext.Current.Request["CategoryName"]; itemCategoryDto.CategoryDesc = System.Web.HttpContext.Current.Request["CategoryDesc"]; itemCategoryDto.CreatedBy = Convert.ToInt32(Session["AdminId"]); itemCategoryDto.ModifiedBy = Convert.ToInt32(Session["AdminId"]); itemCategoryDto.IsActive = 1; int i = itemCategoryDal.SaveItemCategory(itemCategoryDto); return(Json(i, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }