public JsonResult GetEnterprise()
        {
            var enterprise = EnterpriseManager.GetEnterprise(1);

            return(Json(new
            {
                enterprise.Title,
                enterprise.Description,
                enterprise.LogoPath
            }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetEnterpriseContacts(int enterpriseId)
        {
            if (!ExistsOwner())
            {
                Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
                return(null);
            }

            var enterprise = EnterpriseManager.GetEnterprise(enterpriseId);

            return(Json(enterprise.Contacts.Select(contact => new
            {
                contact.Type,
                contact.Text
            })));
        }
Exemple #3
0
        public ActionResult Enterprise(int id)
        {
            if (!ExistsOwner())
            {
                return(RedirectToAction("LogIn", "Owner"));
            }

            var enterprise = EnterpriseManager.GetEnterprise(id);

            if (enterprise == null)
            {
                return(RedirectToAction("Enterprises", "Owner"));
            }

            return(View(enterprise));
        }
        public JsonResult GetEnterpriseBranches(int enterpriseId)
        {
            if (!ExistsOwner())
            {
                Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
                return(null);
            }

            var enterprise = EnterpriseManager.GetEnterprise(enterpriseId);

            return(Json(enterprise.Branches.Select(branch => new
            {
                branch.LogIn,
                branch.CashBoxCount,
                Adress = branch.Country + ", " + branch.City + ", " + branch.Adress
            })));
        }
        public JsonResult GetEnterprise(int id)
        {
            if (!ExistsOwner())
            {
                Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
                return(null);
            }

            var enterprise = EnterpriseManager.GetEnterprise(id);

            return(Json(new
            {
                enterprise.Title,
                enterprise.Description,
                StartDate = enterprise.StartDate.ToShortDateString(),
                Type = GetEnterpriseType(enterprise.Type),
                enterprise.LogoPath
            }));
        }
        public JsonResult GetEnterpriseProducts(int enterpriseId)
        {
            if (!ExistsOwner())
            {
                Response.StatusCode = (int)HttpStatusCode.MethodNotAllowed;
                return(null);
            }

            var enterprise = EnterpriseManager.GetEnterprise(enterpriseId);

            return(Json(enterprise.Products.Select(product => new
            {
                product.Name,
                product.Category,
                product.Description,
                product.Price,
                product.Amount,
                product.PicturePath
            })));
        }