Ejemplo n.º 1
0
        public IActionResult Edit(int id)
        {
            var model = new EditStatusView();

            model.State = _customStateService.GetCustomSateById(id);

            return(View(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id)
        {
            var model = new EditStatusView();

            model.State = await _customStateService.GetCustomSateByIdAsync(id);

            return(View(model));
        }
Ejemplo n.º 3
0
        public IActionResult Edit(EditStatusView model, IFormCollection form)
        {
            if (ModelState.IsValid)
            {
                List <int> options = (from object key in form.Keys
                                      where key.ToString().StartsWith("buttonText_")
                                      select int.Parse(key.ToString().Replace("buttonText_", ""))).ToList();

                var details = new List <CustomStateDetail>();
                var state   = _customStateService.GetCustomSateById(model.State.CustomStateId);

                state.Name        = model.State.Name;
                state.Description = model.State.Description;

                foreach (var i in options)
                {
                    if (form.ContainsKey("buttonText_" + i))
                    {
                        var text      = form["buttonText_" + i];
                        var color     = form["buttonColor_" + i];
                        var textColor = form["textColor_" + i];
                        var order     = form["order_" + i];

                        bool gps      = false;
                        var  gpsValue = form["requireGps_" + i];

                        if (gpsValue == "on")
                        {
                            gps = true;
                        }

                        var noteType   = int.Parse(form["noteType_" + i]);
                        var detailType = int.Parse(form["detailType_" + i]);

                        var detail = new CustomStateDetail();
                        detail.ButtonText  = text;
                        detail.ButtonColor = color;
                        detail.GpsRequired = gps;
                        detail.NoteType    = noteType;
                        detail.DetailType  = detailType;
                        detail.TextColor   = textColor;
                        detail.Order       = int.Parse(order);

                        details.Add(detail);
                    }
                }

                _customStateService.Update(state, details);

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Ejemplo n.º 4
0
 public bool SetEditStatus(EditStatusView editStatusView)
 {
     return(IpublishInfo.SetEditStatus(editStatusView));
 }