public ActionResult AddContact(tblcontact _model, HttpPostedFileBase file) { int adminId = Convert.ToInt16(Session["AdminId"]); contactServices _ser = new Database.contactServices(); if (file != null) { string path = Path.Combine(Server.MapPath("~/assets/images/users"), file.FileName); file.SaveAs(path); _model.ImagePath = "/assets/images/users/" + file.FileName; } else { _model.ImagePath = "/assets/images/icon/staff.png"; } _model.Createddate = DateTime.Now; _model.AdminId = adminId; _model.IsActive = true; var msg = _ser.AddNewContact(_model); if (!string.IsNullOrEmpty(msg)) { ViewData["labels"] = _ser.getAllLablesByAdminid(adminId); ViewData["Error"] = msg; return(View("getContact", _model)); } else { TempData["Error"] = _model.Name + " Created Succesfully"; return(RedirectToAction("index")); } }
public ActionResult LabelList() { int adminId = Convert.ToInt16(Session["AdminId"]); UserViewModel _model = new Models.UserViewModel(); contactServices _ser = new Database.contactServices(); if (TempData["Error"] != null) { _model.Error = TempData["Error"].ToString(); } return(View(_model)); }
public ActionResult labels(int?id) { int adminId = Convert.ToInt16(Session["AdminId"]); Labelitem _model = new Models.Labelitem(); contactServices _ser = new Database.contactServices(); if (id.HasValue) { _model = _ser.getLablesByLabelid(id.Value); return(View("editLabel", _model)); } return(View(_model)); }
public ActionResult Index() { int adminId = Convert.ToInt16(Session["AdminId"]); UserViewModel _model = new Models.UserViewModel(); contactServices _ser = new Database.contactServices(); _model.labels = _ser.getAllLablesByAdminid(adminId)._labelList; if (TempData["Error"] != null) { _model.Error = TempData["Error"].ToString(); } return(View(_model)); }
public ActionResult getContact(int?id) { int adminId = Convert.ToInt16(Session["AdminId"]); tblcontact _contact = new Database.tblcontact(); contactServices _ser = new Database.contactServices(); ViewData["labels"] = _ser.getAllLablesByAdminid(adminId); if (id.HasValue) { _contact = _ser.getContactsByContactid(id.Value); return(View("editcontact", _contact)); } return(View(_contact)); }
public ActionResult editlabels(Labelitem _model) { int adminId = Convert.ToInt16(Session["AdminId"]); contactServices _ser = new Database.contactServices(); var msg = _ser.updateLabelById(_model.LabelId, _model.Active, adminId, _model.Name, _model.description); if (!string.IsNullOrEmpty(msg.Error)) { _model.Error = msg.Error; return(View("editLabel", _model)); } else { TempData["Error"] = _model.Name + " Updated Succesfully"; return(RedirectToAction("Labellist")); } }
public void deletelabel(int id) { contactServices _ser = new Database.contactServices(); _ser.deletelabel(id); }