Ejemplo n.º 1
0
        public ActionResult AddOrUpdateSku(SKUModel sku)
        {
            var message = string.Empty;
            try
            {
                if (ModelState.IsValid)
                {
                    var id = dataService.AddOrUpdateSKU(sku.GetSKUDB());
                    if (id >0)
                    {
                        return RedirectToAction("SkuData",  new {id=id});
                    }
                }
            }
            catch (Exception err)
            {
                message = err.Message;
            }

            return Content("Товар НЕ сохранен " + message, "text/html");
        }
Ejemplo n.º 2
0
        public ActionResult SkuData(long? id)
        {
            var result = new SKUModel();

            try
            {
                if (id.HasValue)
                {
                    var skuDB = dataService.GetSkuById(id.Value);

                    result = skuDB != null ? skuModelBuilder.ConvertSkuBDToSkuModel(skuDB) : skuModelBuilder.GetEmptySku();
                }
                else
                {
                    result = skuModelBuilder.GetEmptySku();
                }

            }
            catch (Exception err)
            {
                return View("MessagesPartial", "Ошибка " + err.Message);
            }

            return View("SkuData", result);
        }