Пример #1
0
        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"));
            }
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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));
        }
Пример #5
0
        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));
        }
Пример #6
0
        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"));
            }
        }
Пример #7
0
        public void deletelabel(int id)
        {
            contactServices _ser = new Database.contactServices();

            _ser.deletelabel(id);
        }