コード例 #1
0
        public JsonResult GetAllSuppier()
        {
            try
            {
                List <tblSupplierInformation> supplierInformations = new List <tblSupplierInformation>();
                var getAllSuppier = unitOfWork.SuppliersInformationRepository.Get();

                foreach (var supplier in getAllSuppier)
                {
                    tblSupplierInformation supplierInformation = new tblSupplierInformation();
                    supplierInformation.SupplierAddress = supplier.SupplierAddress;
                    supplierInformation.SupplierEmail   = supplier.SupplierEmail;
                    supplierInformation.SupplierId      = supplier.SupplierId;
                    supplierInformation.SupplierName    = supplier.SupplierName;
                    supplierInformation.SupplierPhoneNo = supplier.SupplierPhoneNo;
                    supplierInformations.Add(supplierInformation);
                }

                return(Json(new { result = supplierInformations, success = true }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                return(Json(new { errorMessage = exception.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
 public JsonResult UpdateSupplierInformation(tblSupplierInformation suplierInformation)
 {
     try
     {
         UnitOfWork unitOfWork = new UnitOfWork();
         unitOfWork.SuppliersInformationRepository.Update(suplierInformation);
         unitOfWork.Save();
         return(Json(new { success = true, successMessage = "Successfully Updated Supplier Information " }));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, errorMessage = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #3
0
        public JsonResult AddSupplier(tblSupplierInformation supplierInformation)
        {
            try
            {
                supplierInformation.CreatedBy = SessionManger.LoggedInUser(Session);
                //supplierInformation.DateTime = supplierInformation.DateTime = DateTime.Now;
                supplierInformation.RestaurantId = supplierInformation.RestaurantId = Int32.Parse(SessionManger.RestaurantOfLoggedInUser(Session).ToString());

                supplierInformation.CreatedDateTime = supplierInformation.CreatedDateTime = DateTime.Now;
                supplierInformation.EditedDateTime  = supplierInformation.EditedDateTime = null;
                unitOfWork.SuppliersInformationRepository.Insert(supplierInformation);
                unitOfWork.Save();
                return(Json(new { success = true, successMessage = "Successfully Submited" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception exception)
            {
                return(Json(new { errorMessage = exception.Message }, JsonRequestBehavior.AllowGet));
            }
        }