public ClassifiedModel Get(int id) { var classified = _classifiedService.GetById(id); if (classified != null) { return(classified); } else { throw new HttpResponseException(NotFoundMessage("لا يوجد إعلان يتبع لهذا الرقم")); } }
public IActionResult Form(int?id) { Classified = new Data.Models.Classified(); var categories = _categoryService.GetAll().ToList(); categories.Insert(0, new Category { Id = 0, Name = "Select", CategoryImage = "", Status = true }); ViewBag.ListOfCategory = categories; if (id == null) { //Create New return(View(Classified)); } //Update Classified = _classifiedService.GetById(id); if (Classified == null) { return(NotFound()); } return(View(Classified)); }