Exemple #1
0
        public ActionResult Edit(ExpertsObjects objE)
        {
            var b = new ExpertsBCL().Update(objE);

            if (b)
            {
                var acc = new AccountBCL().GetByUserId(objE.ExpertId);
                if (acc != null)
                {
                    acc.FullName    = objE.FullName;
                    acc.Username    = objE.Email;
                    acc.Email       = objE.Email;
                    acc.Phone       = objE.Mobile;
                    acc.Description = objE.Description;
                    acc.Isdeleted   = objE.Status;
                    new AccountBCL().Update(acc);
                }
                return(RedirectToAction("Index", "Expert"));
            }
            else
            {
                ModelState.AddModelError("", "them moi that bai");
            }
            return(View());
        }
 public ActionResult Edit(AccountObject ob)
 {
     try
     {
         if (new AccountBCL().GetAll().Count(q => q.Username == ob.Username) == 2)
         {
             ModelState.AddModelError("", "Tên đăng nhập đã được sử dụng cho người dùng khác");
         }
         else
         {
             ob.Isdeleted = false;
             new AccountBCL().Update(ob);
             var objExper = new ExpertsBCL().GetByExpertId(ob.UserId);
             if (objExper != null)
             {
                 objExper.FullName    = ob.FullName;
                 objExper.Email       = ob.Username;
                 objExper.Email       = ob.Email;
                 objExper.Mobile      = ob.Phone;
                 objExper.Description = ob.Description;
                 new ExpertsBCL().Update(objExper);
             }
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         ModelState.AddModelError("", "Sửa không thành công");
     }
     return(View());
 }
Exemple #3
0
 // GET: Expert
 public ActionResult Index(bool?Status)
 {
     if (Status == null)
     {
         Status = false;
     }
     if (Status == false)
     {
         ViewBag.Status = false;
         var list = new ExpertsBCL().GetAll().Where(x => x.Status == false);
         return(View(list));
     }
     else
     {
         ViewBag.Status = true;
         var list = new ExpertsBCL().GetAll().Where(x => x.Status == true);
         return(View(list));
     }
 }
Exemple #4
0
        public ActionResult Create(ExpertsObjects objE)
        {
            objE.ExpertId = Guid.NewGuid();
            objE.Deleted  = false;
            objE.Status   = false;
            var lisAcc = new AccountBCL().GetAll().Any(x => x.Username == objE.Email);

            if (lisAcc == false)
            {
                var b = new ExpertsBCL().Insert(objE);
                if (b)
                {
                    AccountObject acc = new AccountObject();
                    acc.UserId      = objE.ExpertId;
                    acc.FullName    = objE.FullName;
                    acc.PassWord    = "******";
                    acc.Username    = objE.Email;
                    acc.Email       = objE.Email;
                    acc.Phone       = objE.Mobile;
                    acc.Description = objE.Description;
                    acc.Isdeleted   = objE.Deleted;
                    acc.RoleId      = Guid.Parse("adae8847-5b4d-43fc-a761-038b315d7651");
                    new AccountBCL().Insert(acc);
                    return(RedirectToAction("Index", "Expert"));
                }
                else
                {
                    ModelState.AddModelError("", "them moi that bai");
                }
            }
            else
            {
                ModelState.AddModelError("", "Tài khoản đã có người sử dụng");
            }
            return(View());
        }
Exemple #5
0
        // GET: Expert/Edit/5
        public ActionResult Edit(Guid id)
        {
            var obj = new ExpertsBCL().GetByExpertId(id);

            return(View(obj));
        }
Exemple #6
0
        public JsonResult Delete(Guid ID, FormCollection collection)
        {
            var exper = new ExpertsBCL().Delete(ID);

            return(Json(new AccountBCL().Delete(ID)));
        }