public JsonResult deleteImage(int imageId) { OrgImage orgImage = _orgImageRepository.List().Where(c => c.ImageId == imageId).FirstOrDefault(); _orgImageRepository.Delete(orgImage.Id); _imageRepository.Delete(imageId); return(new JsonResult() { Data = "silindi çok pis" }); }
public ActionResult AddImage(int orgId) { Images img = new Images(); img.imageUrl = Request.Files[0].FileName; _imageRepository.Add(img); string imagePath = ConfigurationManager.AppSettings["ImagePath"] + "/" + img.Id + "_" + img.imageUrl; Request.Files[0].SaveAs(imagePath); OrgImage orgimage = new OrgImage(); orgimage.ImageId = img.Id; orgimage.OrgId = orgId; _orgImageRepository.Add(orgimage); return(RedirectToAction("Detail", new { id = orgId })); }