示例#1
0
        //private string GetContentType(string path)
        //{
        //    var types = GetMimeTypes();
        //    var ext = Path.GetExtension(path).ToLowerInvariant();
        //    return types[ext];
        //}

        //private Dictionary<string, string> GetMimeTypes()
        //{
        //    return new Dictionary<string, string>
        //    {
        //        {".txt", "text/plain"},
        //        {".pdf", "application/pdf"},
        //        {".doc", "application/vnd.ms-word"},
        //        {".docx", "application/vnd.ms-word"},
        //        {".xls", "application/vnd.ms-excel"},
        //        {".xlsx", "application/vnd.openxmlformats officedocument.spreadsheetml.sheet"},
        //        {".png", "image/png"},
        //        {".jpg", "image/jpeg"},
        //        {".jpeg", "image/jpeg"},
        //        {".gif", "image/gif"},
        //        {".csv", "text/csv"}
        //    };
        //}


        public IActionResult VendorFormView(int id)
        {
            var vendor = _vendorRegFormApprovalRepository.GetById(id);
            //var formIdentification = _formIdentificationRepository.GetById(vendor.id)
            var model = new AdminVendorViewModel
            {
                VendorForm = vendor
            };

            return(View(model));
        }
        public ActionResult ViewVendor()
        {
            AdminVendorViewModel model;

            if (User.IsInRole("Admin"))
            {
                string roleId = (from data in context.Roles where data.Name == "Vendor" select data.Id).First();
                model = new AdminVendorViewModel();

                model.Vendors      = context.Users.Where(x => x.Roles.Select(y => y.RoleId).Contains(roleId)).ToList();
                model.Applications = context.VendorApplications.ToList();
            }
            else
            {
                model = new AdminVendorViewModel();
            }


            return(View(model));
        }