Ejemplo n.º 1
0
        public JsonResult Save(BaseWebSocketChannel model, FormCollection form)
        {
            try
            {
                if (string.IsNullOrEmpty(model.ParametersName))
                {
                    model.ParametersName = string.Empty;
                }

                model.ParametersName = model.ParametersName.Trim();
                model.Name           = Regex.Replace(model.Name, @"\s+", "-").Trim();

                if (model.Id != 0)
                {
                    db.Entry(model).State = System.Data.Entity.EntityState.Modified;
                }
                else
                {
                    db.BaseWebSocketChannels.Add(model);
                }

                db.SaveChanges();
                return(Json(new { id = model.Id, MessageSucess = "That Web Socket Channels saved successfully." }));
            }
            catch (Exception ex)
            {
                return(Json(new { Message = Helper.ModeralException(ex).Replace("@table", "Web Socket Channels") }));
            }
        }
Ejemplo n.º 2
0
 public ActionResult FormEmit(int id = 0)
 {
     if (id == 0)
     {
         return(PartialView(new BaseWebSocketChannel()));
     }
     else
     {
         BaseWebSocketChannel model = db.BaseWebSocketChannels.Find(id);
         return(PartialView(model));
     }
 }
Ejemplo n.º 3
0
        public JsonResult get(int id)
        {
            BaseWebSocketChannel model = db.BaseWebSocketChannels.Find(id);

            if (model != null)
            {
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { Message = "This record no longer exists" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 4
0
 public ActionResult Form(int id = 0, string from = "")
 {
     ViewBag.relations = db.VWISRElations.Where(d => d.PK_Table == "BaseWebSocketChannels").ToList();
     ViewBag.from      = from;
     if (id == 0)
     {
         return(PartialView(new BaseWebSocketChannel()));
     }
     else
     {
         BaseWebSocketChannel model = db.BaseWebSocketChannels.Find(id);
         return(PartialView(model));
     }
 }
Ejemplo n.º 5
0
        public JsonResult update(int id, BaseWebSocketChannel model)
        {
            if (string.IsNullOrEmpty(model.ParametersName))
            {
                model.ParametersName = string.Empty;
            }

            model.ParametersName = model.ParametersName.Trim();
            model.Name           = Regex.Replace(model.Name, @"\s+", "-").Trim();

            db.Entry(model).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(Json(new { id = model.Id, MessageSucess = "That Web Socket Channels saved successfully." }));
        }
Ejemplo n.º 6
0
        public JsonResult create(BaseWebSocketChannel model)
        {
            if (string.IsNullOrEmpty(model.ParametersName))
            {
                model.ParametersName = string.Empty;
            }

            model.ParametersName = model.ParametersName.Trim();
            model.Name           = Regex.Replace(model.Name, @"\s+", "-").Trim();

            db.BaseWebSocketChannels.Add(model);
            db.SaveChanges();

            return(Json(new { id = model.Id, MessageSucess = "That Web Socket Channels saved successfully." }));
        }
Ejemplo n.º 7
0
        public JsonResult Delete(int id = 0)
        {
            try
            {
                BaseWebSocketChannel model = db.BaseWebSocketChannels.Find(id);
                if (model != null)
                {
                    db.BaseWebSocketChannels.Remove(model);
                    db.SaveChanges();

                    return(Json(new { id = model.Id, MessageSucess = "That Web Socket Channels deleted successfully." }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { Message = "This record no longer exists" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { Message = Helper.ModeralException(ex).Replace("@table", "Web Socket Channels") }, JsonRequestBehavior.AllowGet));
            }
        }