Example #1
0
 public IActionResult AddSize(AddSizeModel addSizeModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var sizeModel       = SizeHelper.BindSizeModel(addSizeModel);
             var sizeDetailModel = SizeHelper.BindSizeDetailModel(addSizeModel);
             if (sizeModel.SizeId <= 0)
             {
                 long sizeId = iSize.AddSize(sizeModel, sizeDetailModel);
                 if (sizeId > 0)
                 {
                     return(Ok(ResponseHelper.Success(MessageConstants.SizeAdded)));
                 }
                 else if (sizeId == ReturnCode.AlreadyExist.GetHashCode())
                 {
                     return(Ok(ResponseHelper.Error(MessageConstants.SizeExists)));
                 }
                 else
                 {
                     return(Ok(ResponseHelper.Error(MessageConstants.SizeNotAdded)));
                 }
             }
             else
             {
                 long sizeId = iSize.UpdateSize(sizeModel, sizeDetailModel);
                 if (sizeId > 0)
                 {
                     return(Ok(ResponseHelper.Success(MessageConstants.SizeUpdated)));
                 }
                 else if (sizeId == ReturnCode.AlreadyExist.GetHashCode())
                 {
                     return(Ok(ResponseHelper.Error(MessageConstants.TryDifferentName)));
                 }
                 else
                 {
                     return(Ok(ResponseHelper.Error(MessageConstants.SizeNotUpdated)));
                 }
             }
         }
         else
         {
             return(Ok(ResponseHelper.Error(MessageConstants.CompulsoryData)));
         }
     }
     catch (Exception ex)
     {
         LogHelper.ExceptionLog(ex.Message + "  :::::  " + ex.StackTrace);
         return(Ok(ResponseHelper.Error(ex.Message)));
     }
 }
 public IActionResult UpdateSize(Size model)
 {
     _reposSize.UpdateSize(model);
     return(RedirectToAction(nameof(SizeList)));
 }