public ActionResult Edit(SupplierViewModel supplierViewModel)
        {
            string message;

            if (ModelState.IsValid)
            {
                SupplierModel supplier = Mapper.Map <SupplierModel>(supplierViewModel);


                if (_supplierManger.Update(supplier))
                {
                    message = "Update";
                }
                else
                {
                    message = "Not Update";
                }
                // }
            }
            else
            {
                message = "ModelState Failed";
            }


            //


            ViewBag.Message             = message;
            supplierViewModel.Suppliers = _supplierManger.GetAll();
            return(View(supplierViewModel));
        }
예제 #2
0
        public ActionResult Edit([Bind(Include = "Id,Name,Phone,Email,Address,Rate,AppUserId,CreatedDate,CreatedBy,UpdatedDate,UpdatedBy,IsArchived")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                supplier.UpdatedDate = DateTime.Now;
                supplier.UpdatedBy   = HttpContext.Request.UserHostAddress + "/" + User.Identity.Name + "/" + Request.LogonUserIdentity.Name;


                _supplierManger.Update(supplier);
                return(RedirectToAction("Index"));
            }
            ViewBag.AppUserId = new SelectList(_appUserManger.GettAll(), "Id", "Name", supplier.AppUserId);
            return(View(supplier));
        }