Beispiel #1
0
        public JsonResult EditLine(GridLineBusModel model)
        {
            using (var logic = new LineLogic())
            {
                switch ((GridOperation)Enum.Parse(typeof(GridOperation), model.Oper, true))
                {
                //case GridOperation.add:
                //    logic.SaveLine(model.ToDbModel());
                //    break;
                case GridOperation.edit:
                    var existingLine = logic.GetLine(model.Id);
                    if (existingLine != null)
                    {
                        //model.UpdateDbModel(existingLine);
                        //logic.SaveChanges();
                        logic.UpdateBusToLine(model.Id, model.Bus);
                    }
                    break;

                case GridOperation.del:
                    logic.DeleteLine(model.Id);
                    break;
                }
            }
            return(new JsonResult {
                Data = true
            });
        }