public Executive_board RegisterExe(Executive_board ExeBoard) { using (var context = _dbContextFactory.CreateConnection()) { if (ExeBoard.id != 0) { Executive_board BoardMems = context.Executive_board.Where(x => x.id == ExeBoard.id && x.Status == true).FirstOrDefault(); BoardMems.Name = ExeBoard.Name; BoardMems.Email = ExeBoard.Email; BoardMems.Mobile = BoardMems.Mobile; BoardMems.ROle = ExeBoard.ROle; if (ExeBoard.Image != "") { BoardMems.Image = ExeBoard.Image; } else { } context.SaveChanges(); } else { context.Executive_board.Add(ExeBoard); context.SaveChanges(); } return(ExeBoard); } }
public Executive_board GetExecutiveBoardDetails(int id) { using (var context = _dbContextFactory.CreateConnection()) { Executive_board BoardMembers = context.Executive_board.Where(x => x.id == id && x.Status == true).FirstOrDefault(); return(BoardMembers); } }
public ActionResult ExecutiveBoard(ExecutiveBoard ExeBoard, HttpPostedFileBase Image) { var FilePath = ""; if (Image != null) { var fileName = Path.GetFileName(Image.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); Image.SaveAs(path); FilePath = "/UserProfilePictures/" + fileName; } if (ExeBoard.id != 0) { Executive_board UpdateExecutiveBoardmems = new Executive_board() { Email = ExeBoard.Email, CreatedOn = DateTime.Now, Image = FilePath, Mobile = ExeBoard.Mobile, Name = ExeBoard.Name, ROle = ExeBoard.Role, Status = true, id = ExeBoard.id }; EventService.RegisterExe(UpdateExecutiveBoardmems); TempData["Message"] = "Update Successfully"; return(RedirectToAction("ExecutiveBoard", "Dashboard", new { area = "Admin", id = 0 })); } else { Executive_board ExecutiveBoardmems = new Executive_board() { Email = ExeBoard.Email, CreatedOn = DateTime.Now, Image = FilePath, Mobile = ExeBoard.Mobile, Name = ExeBoard.Name, ROle = ExeBoard.Role, Status = true, }; EventService.RegisterExe(ExecutiveBoardmems); TempData["Message"] = "Save Successfully"; return(RedirectToAction("ExecutiveBoard", "Dashboard", new { area = "Admin" })); } }
public ActionResult ExecutiveBoard(ExecutiveBoard ExeBoard, HttpPostedFileBase Image) { var FilePath = ""; if (Image != null) { var fileName = Path.GetFileName(Image.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); Image.SaveAs(path); FilePath = "/UserProfilePictures/" + fileName; } if (ExeBoard.id != 0) { Executive_board UpdateExecutiveBoardmems = new Executive_board() { Email = ExeBoard.Email, CreatedOn = DateTime.Now, Image = FilePath, Mobile = ExeBoard.Mobile, Name = ExeBoard.Name, ROle = ExeBoard.Role, Status = true, id = ExeBoard.id }; EventService.RegisterExe(UpdateExecutiveBoardmems); TempData["Message"] = "Update Successfully"; return RedirectToAction("ExecutiveBoard", "Dashboard", new { area = "Admin", id = 0 }); } else { Executive_board ExecutiveBoardmems = new Executive_board() { Email = ExeBoard.Email, CreatedOn = DateTime.Now, Image = FilePath, Mobile = ExeBoard.Mobile, Name = ExeBoard.Name, ROle = ExeBoard.Role, Status = true, }; EventService.RegisterExe(ExecutiveBoardmems); TempData["Message"] = "Save Successfully"; return RedirectToAction("ExecutiveBoard", "Dashboard", new { area = "Admin" }); } }
public Executive_board RegisterExe(Executive_board ExeBoard) { return(_IEventCategoryRepo.RegisterExe(ExeBoard)); }