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") })); } }
public ActionResult FormEmit(int id = 0) { if (id == 0) { return(PartialView(new BaseWebSocketChannel())); } else { BaseWebSocketChannel model = db.BaseWebSocketChannels.Find(id); return(PartialView(model)); } }
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)); } }
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)); } }
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." })); }
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." })); }
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)); } }