public async Task <IActionResult> MyProjects(MyProjectModel model, IFormFile file) { var project = new MyProjects(); if (ModelState.IsValid) { project.MyProjectHeader = model.MyProjectHeader; project.MyProjectLongDescription = model.MyProjectDescription; project.MyProjectSmallDescription = model.MyProjectSmallDescription; if (file != null) { var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images\\projectImages", file.FileName); using (var stream = new FileStream(path, FileMode.Create)) { await file.CopyToAsync(stream); project.MyProjectImages = file.FileName; } } project.MyProjectLink = model.MyProjectLink; repository.myProject.Add(project); repository.SaveChanges(); TempData["Message"] = $"{model.MyProjectHeader} Kayıt Edildi"; return(RedirectToAction("Index", "Admin")); } else { return(View(model)); } }
public IActionResult Open_Modal_For_Long_Description(int id) { MyProjectModel prjModel = new MyProjectModel(); if (id != 0) { var modal = uow.myProject.GetById(id); if (modal != null) { prjModel.MyProjectHeader = modal.MyProjectHeader; prjModel.MyProjectDescription = modal.MyProjectSmallDescription; prjModel.MyProjectSmallDescription = modal.MyProjectSmallDescription; prjModel.MyProjectImages = modal.MyProjectImages; prjModel.MyProjectLink = modal.MyProjectLink; } return(PartialView("_ProjectDescription", prjModel)); } else { return(View("Error")); } }