public ActionResult Create(Domain.Device.DTOs.DeviceRead device) { if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; int UserId = Convert.ToInt32(cookie.Values["Id"]); device.UserId = UserId; Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); dd.SaveDevice(device); return(RedirectToAction("Index")); } return(RedirectToAction("Create")); }
public ActionResult Edit(Domain.Device.DTOs.DeviceRead device) { try { Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); dd.UpdateDevice(device); return(RedirectToAction("Index")); } catch (Exception ex) { return(RedirectToAction("Edit")); } }
// GET: Device public ActionResult Index() { List <Domain.Device.DTOs.DeviceList> DeviceList = new List <Domain.Device.DTOs.DeviceList>(); if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; int UserId = Convert.ToInt32(cookie.Values["Id"]); Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); DeviceList = dd.GetDeviceList(UserId); } return(View(DeviceList)); }
public ActionResult Create() { Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; int UserId = Convert.ToInt32(cookie.Values["Id"]); ViewBag.Devices = dd.GetDeviceList(UserId); Domain.Profile.ProfileDomain pd = new Domain.Profile.ProfileDomain(); ViewBag.Properties = pd.GetPropertyList(); } return(View()); }
public ActionResult Edit(int Id) { Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); Domain.Alarm.DTOs.AlarmList Alarm = new Domain.Alarm.DTOs.AlarmList(); if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; int UserId = Convert.ToInt32(cookie.Values["Id"]); ViewBag.Devices = dd.GetDeviceList(UserId); Domain.Profile.ProfileDomain pd = new Domain.Profile.ProfileDomain(); ViewBag.Property = pd.GetPropertyList(); } Domain.Alarm.AlarmDomain ad = new Domain.Alarm.AlarmDomain(); return(View(ad.GetAlarmById(Id))); }
public ActionResult Edit(Guid Id) { Domain.Profile.ProfileDomain pd = new Domain.Profile.ProfileDomain(); Domain.Environment.EnvironmentDomain ed = new Domain.Environment.EnvironmentDomain(); int UserId = 0; if (this.ControllerContext.HttpContext.Request.Cookies.AllKeys.Contains("UserCookie")) { HttpCookie cookie = this.ControllerContext.HttpContext.Request.Cookies["UserCookie"]; UserId = Convert.ToInt32(cookie.Values["Id"]); } ViewBag.Profiller = pd.GetProfileList(); ViewBag.Environment = ed.GetAll(UserId); Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); Domain.Device.DTOs.DeviceRead DeviceRead = dd.GetDeviceById(Id); return(View(DeviceRead)); }
public ActionResult Delete(Guid Id) { Domain.Device.DeviceDomain dd = new Domain.Device.DeviceDomain(); dd.DeleteDevice(Id); return(RedirectToAction("Index")); }