コード例 #1
0
ファイル: StateService.cs プロジェクト: AdiSha1995/shopmaxi
 public long AddState(StateObject stateAccount)
 {
     try
     {
         return(_stateRepository.AddState(stateAccount));
     }
     catch (Exception ex)
     {
         ErrorLogger.LogError(ex.StackTrace, ex.Source, ex.Message);
         return(0);
     }
 }
コード例 #2
0
        public ActionResult Create(StateVM model)
        {
            try
            {
                string stateId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                stateId = stateRepository.AddState(model);

                if (!string.IsNullOrWhiteSpace(stateId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            StateId = stateId
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "State details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }