public JsonResult SaveNew(BrandDTO dto) { bool succeeded = false; try { var model = new tbl_brand(); model.brand_name = dto.brand_name; model.brand_address1 = dto.brand_address1; model.brand_address2 = dto.brand_address2; model.brand_city = dto.brand_city; model.brand_state = dto.brand_state; model.brand_zip = dto.brand_zip; model.brand_tel = dto.brand_tel; UnitOfWork.TblBrand.Add(model); UnitOfWork.Save(); dto.id = model.id; } catch (Exception ex) { dto.id = 0; } return(Json(dto, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(tbl_brand brand) { if (brand != null) { repository.Update(brand); } return(RedirectToAction("/")); }
public ActionResult Create(tbl_brand brand) { repository.Save(brand); return(RedirectToAction("/")); }