Beispiel #1
0
 public ActionResult AdminRegistration(LoginAdminData model, HttpPostedFileBase AdminPhoto)
 {
     if (ModelState.IsValid)
     {
         if (AdminPhoto != null && AdminPhoto.ContentLength > 0)
         {
             string url      = string.Empty;
             string fileName = Guid.NewGuid().ToString();
             string path     = string.Empty;
             path = Path.Combine(Constant.Path, fileName.ToString() + "." + Path.GetExtension(AdminPhoto.FileName).Substring(1));
             AdminPhoto.SaveAs(path);
             url = fileName + "." + Path.GetExtension(AdminPhoto.FileName).Substring(1);
             model.AdminImage = url;
         }
         else
         {
             model.AdminImage = "Avtar.png";
         }
         model.Status      = true;
         model.CreatedDate = System.DateTime.Today;
         model.Password    = api.encrypt(model.Password);
         api.AdminRegister(model);
         return(View());
     }
     else
     {
         return(View());
     }
 }
Beispiel #2
0
        public ActionResult AdminProfile(LoginAdminData model, HttpPostedFileBase AdminPhoto)
        {
            ModelState["Password"].Errors.Clear();
            ModelState["ConfirmPassword"].Errors.Clear();

            if (ModelState.IsValid)
            {
                if (AdminPhoto != null && AdminPhoto.ContentLength > 0)
                {
                    string url      = string.Empty;
                    string fileName = Guid.NewGuid().ToString();
                    string path     = string.Empty;
                    path = Path.Combine(Constant.Path, fileName.ToString() + "." + Path.GetExtension(AdminPhoto.FileName).Substring(1));
                    AdminPhoto.SaveAs(path);
                    url = fileName + "." + Path.GetExtension(AdminPhoto.FileName).Substring(1);
                    model.AdminImage = url;
                }
                else
                {
                    var admin = api.GetAdminDetail(model.Id);
                    model.AdminImage = admin.AdminPhoto;
                }
                api.EditAdminRegister(model);
                return(RedirectToAction("AdminProfile", "Login"));
            }
            else
            {
                return(RedirectToAction("AdminProfile", "Login"));
            }
        }
Beispiel #3
0
        public LoginAdminData GetAdminDetail(int Id)
        {
            LoginAdminData result = new LoginAdminData();

            try
            {
                result = (from info in dbAdmin.Table
                          where info.Id == Id
                          select new LoginAdminData
                {
                    Id = info.Id,

                    Name = info.Name,
                    EmailId = info.EmailId,
                    ContactNo = info.ContactNo,
                    Password = info.Password,
                    AdminImage = ImageURL + info.AdminImage,
                    AdminPhoto = info.AdminImage,
                    CreatedDate = info.CreatedDate,
                    Status = info.Status
                }).FirstOrDefault <LoginAdminData>();
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #4
0
        public void EditAdminRegister(LoginAdminData objAdmin)
        {
            LoginAdmin admin = new LoginAdmin();

            admin = (from info in dbAdmin.Table//.Include(x => x.Role)
                     where info.Id == objAdmin.Id
                     select info).FirstOrDefault();
            if (admin != null)
            {
                try
                {
                    admin.Id        = objAdmin.Id;
                    admin.Name      = objAdmin.Name;
                    admin.EmailId   = objAdmin.EmailId;
                    admin.ContactNo = objAdmin.ContactNo;
                    //admin.Password = objAdmin.Password;
                    admin.AdminImage = objAdmin.AdminImage;
                    //admin.CreatedDate = objAdmin.CreatedDate;
                    admin.Status = objAdmin.Status;
                    dbAdmin.Update(admin);
                    dbAdmin.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Beispiel #5
0
        public int AdminRegister(LoginAdminData objAdmin)
        {
            LoginAdmin admin = new LoginAdmin();

            try
            {
                admin.Name        = objAdmin.Name;
                admin.EmailId     = objAdmin.EmailId;
                admin.ContactNo   = objAdmin.ContactNo;
                admin.Password    = objAdmin.Password;
                admin.AdminImage  = objAdmin.AdminImage;
                admin.CreatedDate = objAdmin.CreatedDate;
                admin.Status      = objAdmin.Status;
                dbAdmin.Insert(admin);
                dbAdmin.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }
            return(admin.Id);
        }
Beispiel #6
0
        public void ChangeAdminPassword(LoginAdminData objAdmin)
        {
            LoginAdmin admin = new LoginAdmin();

            admin = (from info in dbAdmin.Table//.Include(x => x.Role)
                     where info.Id == objAdmin.Id
                     select info).FirstOrDefault();
            if (admin != null)
            {
                try
                {
                    admin.Id       = objAdmin.Id;
                    admin.Password = objAdmin.Password;
                    dbAdmin.Update(admin);
                    dbAdmin.SaveChanges();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
Beispiel #7
0
 public void ChangeAdminPassword(LoginAdminData objAdmin)
 {
     loginadminlogic.ChangeAdminPassword(objAdmin);
 }
Beispiel #8
0
 public void EditAdminRegister(LoginAdminData objAdmin)
 {
     loginadminlogic.EditAdminRegister(objAdmin);
 }
Beispiel #9
0
 public int AdminRegister(LoginAdminData objAdmin)
 {
     return(loginadminlogic.AdminRegister(objAdmin));
 }