Exemplo n.º 1
0
        public List <BOVIPTable> GetAllVIP()
        {
            List <BOVIPTable> lst = new List <BOVIPTable>();
            var temp = _db.tblVIPUsers.Where(u => u.IsDeleted == false).ToList();

            foreach (var model in temp)
            {
                BOVIPTable vip = new BOVIPTable();
                vip.Id            = model.Id;
                vip.Address1      = model.Address1;
                vip.Address2      = model.Address2;
                vip.LastUpdated   = DateTime.Now.ToString();
                vip.DepartmentId  = model.DepartmentId;
                vip.lstDepartment = bldepartment.GetDepartmentById(model.DepartmentId.Value);
                vip.Designation   = model.Designation;
                vip.Details       = model.Details;
                vip.Email         = model.Email;
                vip.FullName      = model.FullName;
                vip.Phone         = model.Phone;
                vip.Photo         = model.Photo;
                vip.UserId        = model.UserId;
                lst.Add(vip);
            }
            return(lst);
        }
        public ActionResult EditVIP(int id)
        {
            BOVIPTable vip = bllvip.GetVIPById(id);

            ViewBag.Department = bllDepartment.GetAllDepartment();
            return(View(vip));
        }
        public ActionResult CreateVIP(BOVIPTable model)
        {
            if (bllvip.CreateVIP(model) == 1)
            {
                Roles.RemoveUserFromRole(model.Email, "CompanyMaster");
                Roles.AddUserToRole(model.Email, "COMPANYVIP");
                //var roleManager = new RoleManager<IdentityRole>(new RoleStore<IdentityRole>(new ApplicationDbContext()));
                //RedirectToAction("CreateVIP", "MyAccountController", new { model = model });
                //AccountController ac = new AccountController();
                //string userid=User.Identity.GetUserId();
                //var roleresult =ac.UserManager.AddToRole(model.UserId, "CompanyMaster");
                ViewBag.Message = "VIP Created Success ! ";
                //Roles.AddUsersToRole(User.Identity., "CompanyMaster");
            }
            else
            {
                ViewBag.Message = "There was a problem creating VIP. Please contact Administrator for details. ";
            }

            ViewBag.Department = bllDepartment.GetAllDepartment().Where(u => u.CompanyId == companyId).ToList();
            var y = bluser.GetAllUsers();

            ViewBag.Users = y;
            return(View());
        }
Exemplo n.º 4
0
        public List <BOVIPTable> GetAllVIPByDepartmentId(int id)
        {
            List <BOVIPTable> lst = new List <BOVIPTable>();
            var temp = _db.tblVIPUsers.Where(u => u.IsDeleted == false && u.DepartmentId == id).ToList();

            foreach (var model in temp)
            {
                BOVIPTable vip = new BOVIPTable();
                vip.Id       = model.Id;
                vip.UserId   = model.UserId;
                vip.FullName = model.FullName;
                lst.Add(vip);
            }
            return(lst);
        }
Exemplo n.º 5
0
        public int UpdateVIP(BOVIPTable model)
        {
            tblVIPUser vip = _db.tblVIPUsers.Where(u => u.Id == model.Id).FirstOrDefault();

            vip.Address1    = model.Address1;
            vip.Address2    = model.Address2;
            vip.LastUpdated = DateTime.Now.ToString();
            //vip.DepartmentId = model.DepartmentId;
            vip.Designation = model.Designation;
            vip.Details     = model.Details;
            vip.Email       = model.Email;
            vip.FullName    = model.FullName;
            vip.Phone       = model.Phone;
            vip.Photo       = model.Photo;
            //  vip.UserId = model.UserId;
            return(_db.SaveChanges());
        }
Exemplo n.º 6
0
        public BOVIPTable GetVIPById(int id)
        {
            tblVIPUser model = _db.tblVIPUsers.Where(u => u.Id == id && u.IsDeleted == false).FirstOrDefault();
            BOVIPTable vip   = new BOVIPTable();

            vip.Id            = model.Id;
            vip.Address1      = model.Address1;
            vip.Address2      = model.Address2;
            vip.DepartmentId  = model.DepartmentId;
            vip.lstDepartment = bldepartment.GetDepartmentById(model.DepartmentId.Value);
            vip.Designation   = model.Designation;
            vip.Details       = model.Details;
            vip.Email         = model.Email;
            vip.FullName      = model.FullName;
            vip.Phone         = model.Phone;
            vip.Photo         = model.Photo;
            vip.UserId        = model.UserId;
            return(vip);
        }
Exemplo n.º 7
0
        public int CreateVIP(BOVIPTable model)
        {
            tblVIPUser vip = new tblVIPUser();

            vip.Address1     = model.Address1;
            vip.Address2     = model.Address2;
            vip.CreatedAt    = DateTime.Now.ToString();
            vip.DepartmentId = model.DepartmentId;
            vip.UserId       = model.UserId;
            vip.Designation  = model.Designation;
            vip.Details      = model.Details;
            vip.Email        = model.Email;
            vip.FullName     = model.FullName;
            vip.IsDeleted    = false;
            vip.Phone        = model.Phone;
            vip.Photo        = model.Photo;
            _db.tblVIPUsers.Add(vip);
            return(_db.SaveChanges());
        }
 public ActionResult Index(BOVIPTable model)
 {
     blvip.UpdateVIP(model);
     return View(model);
 }
 public ActionResult Index()
 {
     BOVIPTable vip = blvip.GetVIPById(VIPID);
     return View(vip);
    
 }
        public ActionResult DetailsVIP(int id)
        {
            BOVIPTable vip = bllvip.GetVIPById(id);

            return(View(vip));
        }
 public ActionResult EditVIP(BOVIPTable model)
 {
     bllvip.UpdateVIP(model);
     ViewBag.Department = bllDepartment.GetAllDepartment();
     return(RedirectToAction("VIP"));
 }
 public ActionResult DeleteVIP(BOVIPTable model)
 {
     bllvip.DeleteVIP(model.Id);
     return(RedirectToAction("VIP"));
 }
        public ActionResult DeleteVIP(int id)
        {
            BOVIPTable model = bllvip.GetVIPById(id);

            return(View(model));
        }