public ActionResult Create(Customer customer) { try { if (ModelState.IsValid) { var obj = new FileUploadHelper(); var filename = obj.SaveImages(); if (filename == obj.ErrorMessage) { ModelState.AddModelError("ImageUpload Error", filename); return View(customer); } customer.ImageUrl = filename; CustomerService.Add(customer); return RedirectToAction("Index"); } else { return View(customer); } } catch(Exception ex) { ModelState.AddModelError("Error", ex.Message); return View(customer); } }
public Customer Add(Customer objContactUs) { try { objContactUs = repository.Add(objContactUs); unitOfWork.Commit(); return objContactUs; } catch (Exception) { throw; } }
public Customer Update(Customer entity) { entity = repository.Update(entity); unitOfWork.Commit(); return entity; }
public void Delete(Customer entity) { repository.Delete(entity); unitOfWork.Commit(); }