Beispiel #1
0
        public virtual ActionResult SaveDetails(QuantityUnitDto dto)
        {
            bool   isSuccess    = false;
            string alertMessage = string.Empty;

            if (ModelState.IsValid)
            {
                var duplicate = _quantityUnitService.GetAll().Where(c => c.UnitName == dto.UnitName).Count();

                if (duplicate >= 1)
                {
                    alertMessage = (string.Format(Messages.DuplicateItem, "Unit"));
                }
                else
                {
                    dto.QuantityUnitID = 0;
                    isSuccess          = this._quantityUnitService.SaveDetails(dto);
                    if (!isSuccess)
                    {
                        alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving in unit");
                    }
                    else
                    {
                        alertMessage = (Messages.InsertSuccess);
                    }
                }
            }
            else
            {
                alertMessage = Messages.ErrorOccuredDuringProcessingOrRequiredFields;
            }


            var jsonResult = new
            {
                isSuccess    = isSuccess,
                alertMessage = alertMessage
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public virtual ActionResult GetQuantityUnit()
        {
            var result = _quantityUnitService.GetAll();

            return(Json(result, JsonRequestBehavior.AllowGet));
        }