コード例 #1
0
        public ActionResult DoObsolete(int id)
        {
            try
            {
                var response = new ResponseMessageModel();

                using (var service = new FranchiseSettingService())
                {
                    service.DoObsolete(id, User.Identity.GetUserId(), response);
                }

                if (response.HasError)
                {
                    response.Title = ResShared.TITLE_OBSOLETE_FAILED;
                }

                return(Json(response));
                //}
            }
            catch (Exception ex)
            {
                SharedLogger.LogError(ex, id);
                return(Json(new ResponseMessageModel
                {
                    HasError = true,
                    Title = ResShared.TITLE_OBSOLETE_FAILED,
                    Message = ResShared.ERROR_UNKOWN
                }));
            }
        }
コード例 #2
0
        public ActionResult DoUpsert(FranchiseUpModel model)
        {
            try
            {
                if (ModelState.IsValid == false)
                {
                    return(Json(new ResponseMessageModel
                    {
                        HasError = true,
                        Title = ResShared.TITLE_REGISTER_FAILED,
                        Message = ResShared.ERROR_INVALID_MODEL
                    }));
                }

                using (var service = new FranchiseSettingService())
                {
                    var response = service.ValidateModel(model);

                    if (response.HasError)
                    {
                        response.Title = ResShared.TITLE_REGISTER_FAILED;
                        return(Json(response));
                    }

                    model.UserInsUpId = User.Identity.GetUserId();
                    response          = service.Save(model);

                    if (response.HasError)
                    {
                        response.Title = ResShared.TITLE_REGISTER_FAILED;
                    }

                    return(Json(response));
                }
            }
            catch (Exception ex)
            {
                SharedLogger.LogError(ex);
                return(Json(new ResponseMessageModel
                {
                    HasError = true,
                    Title = ResShared.TITLE_REGISTER_FAILED,
                    Message = ResShared.ERROR_UNKOWN
                }));
            }
        }
コード例 #3
0
 public ActionResult DoVersion(int franchiseId)
 {
     try
     {
         using (var service = new FranchiseSettingService())
         {
             var response = new ResponseMessageModel();
             service.CreateNewVersion(franchiseId, response, User.Identity.GetUserId());
             return(Json(response));
         }
     }
     catch (Exception ex)
     {
         SharedLogger.LogError(ex);
         return(Json(new ResponseMessageModel
         {
             HasError = true,
             Title = ResShared.TITLE_REGISTER_FAILED,
             Message = ResShared.ERROR_UNKOWN
         }));
     }
 }