public IActionResult DeletePartner(int id) { var p = partnersManager.Get().Where(e => e.Id == id).FirstOrDefault(); partnersManager.Delete(p); return(RedirectToAction("Index")); }
public async Task <IActionResult> PostTeamMember(IFormFile uploads, string Text, int id) { if (id != 0) { var item = partnersManager.Get().Where(e => e.Id == id).FirstOrDefault(); item.ParnerAbout = Text; string path1 = "/images/" + uploads.FileName; if (path1 == null) { path1 = ""; } using (var fileStream = new FileStream(appEnvironment.WebRootPath + path1, FileMode.Create)) { await uploads.CopyToAsync(fileStream); } Image image = new Image() { ImagePath = path1 }; imageManager.Insert(image); item.Image_Id = image.Id; partnersManager.Update(item); } else { string path1 = "/images/" + uploads.FileName; if (path1 == null) { path1 = ""; } using (var fileStream = new FileStream(appEnvironment.WebRootPath + path1, FileMode.Create)) { await uploads.CopyToAsync(fileStream); } Image image = new Image() { ImagePath = path1 }; imageManager.Insert(image); partnersManager.Insert(new Partners() { Image_Id = image.Id, isCrew = false, ParnerAbout = Text }); } return(RedirectToAction("AboutUnion")); }