Beispiel #1
0
        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);
 }
Beispiel #3
0
 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();
 }
Beispiel #5
0
 internal bool UpdateProject(ProjectModel model)
 {
     ProjectEntity project = ProjectMapper.ProjectModelToProjectEntity(model);
     return repo.Update(project);
 }
Beispiel #6
0
 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);
 }