コード例 #1
0
        public ActionResult Actions()
        {
            var           msg   = new JsonMessage();
            var           model = new HomeNetwork();
            StringBuilder stbMessage;

            switch (DoAction)
            {
            case ActionType.Add:
                try
                {
                    UpdateModel(model);
                    _da.Add(model);
                    _da.Save();
                    msg = new JsonMessage
                    {
                        Erros   = false,
                        ID      = model.ID.ToString(),
                        Message = string.Format("Đã thêm mới vị trí : <b>{0}</b>", Server.HtmlEncode(model.Name))
                    };
                }
                catch (Exception ex)
                {
                    LogHelper.Instance.LogError(GetType(), ex);
                }
                break;

            case ActionType.Edit:
                try
                {
                    model = _da.GetById(ArrId.FirstOrDefault());
                    UpdateModel(model);
                    _da.Save();
                    msg = new JsonMessage
                    {
                        Erros   = false,
                        ID      = model.ID.ToString(),
                        Message = string.Format("Đã cập nhật : <b>{0}</b>", Server.HtmlEncode(model.Name))
                    };
                }
                catch (Exception ex)
                {
                    LogHelper.Instance.LogError(GetType(), ex);
                }
                break;
            }
            if (string.IsNullOrEmpty(msg.Message))
            {
                msg.Message = "Không có hành động nào được thực hiện.";
                msg.Erros   = true;
            }

            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult AjaxForm()
        {
            var model = new HomeNetwork();

            if (DoAction == ActionType.Edit)
            {
                model = _da.GetById(ArrId.FirstOrDefault());
            }
            ViewBag.Action     = DoAction;
            ViewBag.ActionText = ActionText;
            return(View(model));
        }
コード例 #3
0
 public static HomeNetworkUpdateRequestBuilder Update(string externalId, HomeNetwork homeNetwork)
 {
     return(new HomeNetworkUpdateRequestBuilder(externalId, homeNetwork));
 }
コード例 #4
0
 public static HomeNetworkAddRequestBuilder Add(HomeNetwork homeNetwork)
 {
     return(new HomeNetworkAddRequestBuilder(homeNetwork));
 }