public ActionResult EditServiceSale(int id)
        {
            string path   = HttpContext.Request.UrlReferrer.PathAndQuery;
            var    entity = rpservicesale.Find(id);
            var    model  = new ServiceSaleVM
            {
                ID           = entity.ID,
                CustomerName = entity.CustomerName,
                EmployeeID   = entity.EmployeeID,
                IMEINumber   = entity.IMEINumber,
                Note         = entity.Note,
                PaymentType  = entity.PaymentType,
                Price        = entity.Price,
                ProductModel = entity.ProductModel,
                RedirectPath = path
            };

            GetAdminUsers();
            return(View(model));
        }
 public ActionResult AddServiceSale(ServiceSaleVM model)
 {
     if (ModelState.IsValid)
     {
         int         userId = UserID();
         ServiceSale entity = new ServiceSale()
         {
             PaymentType  = model.PaymentType,
             Price        = model.Price,
             UserID       = userId,
             Note         = model.Note,
             CustomerName = model.CustomerName,
             EmployeeID   = model.EmployeeID,
             IMEINumber   = model.IMEINumber,
             ProductModel = model.ProductModel
         };
         rpservicesale.Add(entity);
     }
     ViewBag.IslemDurum = EnumIslemDurum.Basarili;
     return(RedirectToAction("Index"));
 }
        public ActionResult EditServiceSale(ServiceSaleVM model)
        {
            if (ModelState.IsValid)
            {
                var entity = rpservicesale.Find(model.ID);
                entity.CustomerName = model.CustomerName;
                entity.EmployeeID   = model.EmployeeID;
                entity.IMEINumber   = model.IMEINumber;
                entity.Note         = model.Note;
                entity.PaymentType  = model.PaymentType;
                entity.Price        = model.Price;
                entity.ProductModel = model.ProductModel;
                ViewBag.IslemDurum  = EnumIslemDurum.Basarili;
                rpservicesale.SaveChanges();
            }
            else
            {
                ViewBag.IslemDurum = EnumIslemDurum.ValidationHata;
            }

            GetAdminUsers();
            return(View(model));
        }