public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OperationType operationType = _operationTypeManger.GetBy(id);

            if (operationType == null)
            {
                return(HttpNotFound());
            }
            return(View(operationType));
        }
        public RedirectToRouteResult CachDone(Cart cart, OperationType operationType)
        {
            Bill bill = new Bill();

            bill.FullPrice   = cart.ComputeTotalValue();
            bill.CreatedDate = DateTime.Now;
            DateTime dt = (DateTime)bill.CreatedDate;

            bill.DateOfExpire    = dt.AddMonths(8);
            bill.OperationTypeId = _OperationTypeManger.GettAll().Where(c => c.Name == "Cach").First().Id;
            bill.OperationTypeId = operationType.Id;
            bill.paymentMethodId = _PaymentMethodManger.GettAll().Where(c => c.Name == "CachInvoice").First().Id;
            bill.UpdatedDate     = DateTime.Now;
            bill.CreatedBy       = HttpContext.Request.UserHostAddress + "/" + User.Identity.Name + "/" + Request.LogonUserIdentity.Name;
            bill.UpdatedBy       = HttpContext.Request.UserHostAddress + "/" + User.Identity.Name + "/" + Request.LogonUserIdentity.Name;
            _billmanger.Add(bill);

            Operation operation = new Operation();

            foreach (var item in cart.lines)
            {
                operation.Bill_Id         = bill.Id;
                operation.OperationTypeId = operationType.Id;
                operation.ProductId       = item.Product.Id;
                operation.ItemNumber      = item.Quantity;
                operation.Value           = item.Product.SellingPrice * item.Quantity;
                operation.CreatedDate     = DateTime.Now;
                operation.UpdatedDate     = DateTime.Now;
                operation.CreatedBy       = HttpContext.Request.UserHostAddress + "/" + User.Identity.Name + "/" + Request.LogonUserIdentity.Name;
                operation.UpdatedBy       = HttpContext.Request.UserHostAddress + "/" + User.Identity.Name + "/" + Request.LogonUserIdentity.Name;
                _Operationmanger.Add(operation);
            }

            foreach (var item in cart.lines)
            {
                if (_OperationTypeManger.GetBy(operationType.Id).Name == "Discarded")
                {
                    Product MyProduct = _productManger.GettAll().Where(c => c.Id == item.Product.Id).First();
                    MyProduct.Quentity = MyProduct.Quentity + item.Quantity;
                    _productManger.Save();
                }
                else
                {
                    Product MyProduct = _productManger.GettAll().Where(c => c.Id == item.Product.Id).First();
                    MyProduct.Quentity = MyProduct.Quentity - item.Quantity;
                    _productManger.Save();
                }
            }
            return(RedirectToAction("List", "Product"));
        }