Beispiel #1
0
        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));
        }
Beispiel #2
0
 public ActionResult Edit(tbl_brand brand)
 {
     if (brand != null)
     {
         repository.Update(brand);
     }
     return(RedirectToAction("/"));
 }
Beispiel #3
0
 public ActionResult Create(tbl_brand brand)
 {
     repository.Save(brand);
     return(RedirectToAction("/"));
 }