public bool Insert(ExpertsObjects ob) { var db = new eTrainingScheduleEntities(); var data = db.sp_tbl_S07_Experts_INSERT(ob.ExpertId, ob.FullName, ob.Email, ob.Mobile, ob.Address, ob.Specialize, ob.StartDate, ob.Status, ob.Description, ob.Deleted); return(true); }
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 ExpertsObjects GetByExpertId(Guid ID) { var db = new eTrainingScheduleEntities(); var list = db.sp_tbl_S07_Experts_GetByExpertId(ID); foreach (var item in list) { ExpertsObjects obj = new ExpertsObjects(); obj.ExpertId = item.ExpertId; obj.FullName = item.FullName; obj.Email = item.Email; obj.Mobile = item.Mobile; obj.Address = item.Address; obj.Specialize = item.Specialize; obj.StartDate = item.StartDate; obj.Status = item.Status == true; obj.Description = item.Description; obj.Deleted = item.Deleted; return(obj); } return(null); }
public List <ExpertsObjects> GetAll() { List <ExpertsObjects> lst = new List <ExpertsObjects>(); var db = new eTrainingScheduleEntities(); var list = db.sp_tbl_S07_Experts_GetAll(); foreach (var item in list) { if (item.Deleted == true) { continue; } ExpertsObjects ob = new ExpertsObjects(); ob.ExpertId = item.ExpertId; ob.FullName = item.FullName; ob.Email = item.Email; ob.Mobile = item.Mobile; ob.Address = item.Address; ob.Specialize = item.Specialize; ob.StartDate = item.StartDate; ob.Status = item.Status; ob.Description = item.Description; ob.Deleted = item.Deleted; lst.Add(ob); } return(lst); }
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()); }
public bool Insert(ExpertsObjects ob) { return(new ExpertsDao().Insert(ob)); }
public bool Update(ExpertsObjects ob) { return(new ExpertsDao().Update(ob)); }