internal bool AddProject(ProjectModel model) { model.ProjectImageContent = ProjectImageToBinary(model.ProjectImage); ProjectEntity project = ProjectMapper.ProjectModelToProjectEntity(model); return repo.Add(project); }
public ActionResult Add(ProjectModel model) { if (ModelState.IsValid) { bool isAdded = projectBLL.AddProject(model); return RedirectToAction("Add", new { result = MessageType.Success }); } return View(model); }
public static ProjectEntity ProjectModelToProjectEntity(ProjectModel model) { return new ProjectEntity { Id = model.Id, Description = model.Description, ProjectName = model.ProjectName, ProjectImage = model.ProjectImageContent }; }
public ActionResult Delete(ProjectModel model) { bool isDeleted = projectBLL.Delete(model); MessageType result = MessageType.Success; string message = result == MessageType.Success ? "Project deleted successfully." : result == MessageType.Failure ? "An error occurred, please try again later." : ""; ViewBag.Message = message; ViewBag.MessageType = result; return View(); }
internal bool UpdateProject(ProjectModel model) { ProjectEntity project = ProjectMapper.ProjectModelToProjectEntity(model); return repo.Update(project); }
internal bool Delete(ProjectModel model) { return repo.Delete(model.Id); }
public ActionResult Edit(ProjectModel model) { if (ModelState.IsValid) { bool isUpdated = projectBLL.UpdateProject(model); return RedirectToAction("Edit", new { result = MessageType.Success }); } return View(model); }