Example #1
0
        public async Task <Response> AddVendor(VendorVM vendor)

        {
            var Dto = Mapper.Map <VendorVM, Vendor>(vendor);

            Vendor Exist = await _db.Vendors.Where(x => x.Name.Trim() == vendor.Name.Trim()).FirstOrDefaultAsync();

            if (Exist != null)
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoAlreadyExist, (int)Constant.httpStatus.NoContent, 0));
            }

            _db.Vendors.Add(Dto);

            int result = await _db.SaveChangesAsync();

            if (result == 1)
            {
                // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
            }
            else
            {
                return(GenericResponses <int> .ResponseStatus(true, Constant.MDGNoLoginFailed, (int)Constant.httpStatus.NoContent, result));
            }
        }
Example #2
0
        public async Task <JsonResult> RemoveVendor(VendorVM vendor)
        {
            Response r = await Repository.RemoveVendor(vendor);

            //  List<UserVM> employees = ((IEnumerable)r.Value).Cast<UserVM>().ToList(); ;
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public VendorVM GetVendor(int vendorId)
        {
            VendorVM vm = null;

            if (vendorId > 0)
            {
                vm = _db.Restaurants.OrderBy(r => r.Name).Where(r => r.Id == vendorId && !r.IsRetired).Select(v => new VendorVM
                {
                    Id          = v.Id,
                    Name        = v.Name,
                    Description = v.Description,
                    Categories  = v.Categories.OrderBy(c => c.Name).Where(c => !c.IsRetired).Select(c => new CategoryVM
                    {
                        Id    = c.Id,
                        Name  = c.Name,
                        Items = c.Items.OrderBy(i => i.Name).Where(i => !i.IsRetired).Select(i => new ItemVM
                        {
                            Id        = i.Id,
                            Name      = i.Name,
                            ImageUrl  = i.ImageUrl,
                            Price     = i.Price,
                            IsAlcohol = i.IsAlcohol
                        }).ToList()
                    }).ToList()
                }).FirstOrDefault();
            }

            return(vm);
        }
Example #4
0
        public async Task <Response> RemoveVendor(VendorVM vendor)
        {
            try
            {
                var DTO = await _db.Vendors.Where(x => x.Id == vendor.Id).FirstOrDefaultAsync();

                _db.Vendors.Remove(DTO);

                int result = await _db.SaveChangesAsync();

                if (result == 1)
                {
                    // Mapper.Initialize(cfg => cfg.CreateMap<User, UserVM>());

                    return(GenericResponses <int> .ResponseStatus(false, Constant.MSGRecordFound, (int)Constant.httpStatus.Ok, result));
                }
                else
                {
                    return(GenericResponses <int> .ResponseStatus(true, Constant.MSGFailed, (int)Constant.httpStatus.NoContent, result));
                }
            }
            catch (Exception e)
            {
                return(GenericResponses <int> .ResponseStatus(true, e.Message, (int)Constant.httpStatus.NoContent, 0));
            }
        }
        public VendorVM GetVendor(int restId)
        {
            VendorVM vm = _db.Restaurants.Where(r => r.Id == restId).Select(r => new VendorVM
            {
                Id          = r.Id,
                Name        = r.Name,
                Description = r.Description,
                ImageUrl    = r.ImageUrl,
                Categories  = r.Categories.Where(c => !c.IsRetired).OrderBy(c => c.Name).Select(c => new CategoryVM
                {
                    Id    = c.Id,
                    Name  = c.Name,
                    Items = c.Items.Where(i => !i.IsRetired).OrderBy(i => i.Name).Select(i => new ItemVM
                    {
                        Id          = i.Id,
                        Name        = i.Name,
                        ImageUrl    = i.ImageUrl,
                        Description = i.Description,
                        Price       = i.Price,
                        Discount    = i.Discount,
                        //Views = i.Views.Count,
                        //Purchases = i.Purchases.Count,
                        IsAlcohol = i.IsAlcohol
                    }).ToList()
                }).ToList()
            }).FirstOrDefault();

            return(vm);
        }
Example #6
0
        protected virtual void UpdateLocales(Vendor vendor, VendorVM model)
        {
            foreach (var localized in model.Locales)
            {
                _localizedEntityService.SaveLocalizedValue(vendor,
                                                           x => x.Name,
                                                           localized.Name,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(vendor,
                                                           x => x.Description,
                                                           localized.Description,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(vendor,
                                                           x => x.MetaKeywords,
                                                           localized.MetaKeywords,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(vendor,
                                                           x => x.MetaDescription,
                                                           localized.MetaDescription,
                                                           localized.LanguageId);

                _localizedEntityService.SaveLocalizedValue(vendor,
                                                           x => x.MetaTitle,
                                                           localized.MetaTitle,
                                                           localized.LanguageId);

                //search engine name
                //var seName = vendor.ValidateSeName(localized.SeName, localized.Name, false, _urlRecordService, _seoSettings);
                //_urlRecordService.SaveSlug(vendor, seName, localized.LanguageId);
            }
        }
        public async Task <ActionResult> Create(VendorVM model)
        {
            if (_db.Vendors.IsExistSmsNumber(0, model.SmsNumber))
            {
                ModelState.AddModelError("SmsNumber", "SMS Number Already exist");
            }

            if (!ModelState.IsValid)
            {
                return(View($"_Create", model));
            }

            var vendor = _db.Vendors.AddCustom(model);
            var task   = await _db.SaveChangesAsync();

            if (task != 0)
            {
                model.VendorID = vendor.VendorID;
                var result = new AjaxContent <VendorVM> {
                    Status = true, Data = model
                };
                return(Json(result));
            }

            ModelState.AddModelError("", "Unable to insert record!");
            return(View($"_Create", model));
        }
Example #8
0
        public ActionResult Index()
        {
            VendorVM Vendor = new VendorVM();

            Vendor.Vendors = UOW.Vendors.GetAllVendors();

            return(View(Vendor));
        }
Example #9
0
 public static string GetCertificationDescription(
     this VendorVM model, HtmlHelper helper)
 {
     return(GetText(() => model.Vendor.Certifications.Where(c => c.IsActive)
                    .Cast <object>(),
                    model.Vendor.CertificationDescription, helper,
                    Certifications));
 }
Example #10
0
        public HttpResponseMessage Create(HttpRequestMessage request, VendorVM model, bool continueEditing = false)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = request.CreateResponse(HttpStatusCode.NotFound, "No items found");
                if (true)
                {
                    if (ModelState.IsValid)
                    {
                        var vendor = model.ToEntity();
                        _vendorService.InsertVendor(vendor);

                        //activity log
                        _customerActivityService.InsertActivity("AddNewVendor", _localizationService.GetResource("ActivityLog.AddNewVendor"), vendor.Id);

                        //search engine name
                        //model.SeName = vendor.ValidateSeName(model.SeName, vendor.Name, true, _urlRecordService, _seoSettings);
                        //_urlRecordService.SaveSlug(vendor, model.SeName, 0);

                        //address
                        var address = model.Address.ToEntity();
                        address.CreatedOnUtc = DateTime.UtcNow;
                        //some validation
                        if (address.CountryId == 0)
                        {
                            address.CountryId = null;
                        }
                        if (address.StateProvinceId == 0)
                        {
                            address.StateProvinceId = null;
                        }
                        _addressService.InsertAddress(address);
                        vendor.AddressId = address.Id;
                        _vendorService.UpdateVendor(vendor);

                        //locales
                        UpdateLocales(vendor, model);
                        //update picture seo file name
                        UpdatePictureSeoNames(vendor);

                        _baseService.Commit();
                        response = request.CreateResponse <VendorVM>(HttpStatusCode.Created, model);
                        if (continueEditing)
                        {
                            string uri = Url.Link("GetVendorById", new { id = vendor.Id });
                            response.Headers.Location = new Uri(uri);
                        }
                        else
                        {
                            string uri = Url.Link("VendorList", null);
                            response.Headers.Location = new Uri(uri);
                        }
                        return response;
                    }
                }
                return response;
            }));
        }
Example #11
0
        public async Task <JsonResult> AddVendor(VendorVM vendor)
        {
            vendor.EcomID = (int)Session["Comp"];

            Response r = await Repository.AddVendor(vendor);

            //  List<UserVM> employees = ((IEnumerable)r.Value).Cast<UserVM>().ToList(); ;
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
Example #12
0
        public static string GetTestingDescription(
            this VendorVM model, HtmlHelper helper)
        {
            var result = GetTestText(() => model.Vendor.Exams
                                     .Where(e => e.Available && e.ExamPrice > 0).Take(30),
                                     model.Vendor.TestingDescription, helper,
                                     Tests);

            result = GetNewText(result,
                                TestsLink,
                                () => helper.VendorExamLink(model.Vendor));
            return(result);
        }
Example #13
0
        public virtual ActionResult Details(string urlName, string urlPart, int?pageIndex)
        {
            VendorVM model;

            if (urlPart.IsEmpty())
            {
                model = VendorVMService.GetBy(urlName, null);
                if (model == null)
                {
                    return(null);
                }
            }
            else if (urlPart == VendorVM.Tab.Testing)
            {
                if (!pageIndex.HasValue)
                {
                    return(RedirectToAction(() => Details(urlName, urlPart, 1)));
                }
                var vendor = VendorService.GetAll().ByUrlName(urlName);
                if (vendor == null)
                {
                    return(NotFound());
                }
                var exams = new ExamListVM {
                    Exams = ExamService.GetAll().Where(e => e.ExamPrice > 0 && e.Available)
                            .Where(e => e.Vendor_ID == vendor.Vendor_ID)
                            .OrderBy(e => e.Exam_TC)
                            .ToPagedList(pageIndex.GetValueOrDefault() - 1),
                    Vendor = vendor
                };
                model = new VendorVM(vendor)
                {
                    CurrentTab = 2,
                    Exams      = exams
                };
            }
            else
            {
                var vendor = VendorService.GetAll().ByUrlName(urlName);
                if (vendor == null)
                {
                    return(null);
                }
                model = new VendorVM(vendor)
                {
                    CurrentTab = 1
                };
            }

            return(View(model));
        }
Example #14
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Vendor = (await _vendorService.GetVendorDetails(id.GetValueOrDefault())).Data;

            if (Vendor == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Example #15
0
        public JsonResult Insert_Vendor(VendorVM VendorVM)
        {
            bool result = false;

            string msg = "Failed to save record..";

            result = VendorMethods.Insert_Vendor(VendorVM, Session["DealerCode"].ToString());

            if (result)
            {
                msg = "Successfully Added";
            }

            return(Json(new { Success = result, Message = msg }, JsonRequestBehavior.AllowGet));
        }
Example #16
0
        // GET: Admin/Vendor/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Vendor vendor = db.vendors.Find(id);

            VendorVM model = new VendorVM(vendor);

            if (vendor == null)
            {
                return(HttpNotFound());
            }

            return(View(model));
        }
        public ActionResult Getvendor(string id)
        {
            VendorVM vendorVM = _context.vendors.Where(a => a.vendor_id == id).Include(a => a.ApplicationUser).Include(a => a.category).Select(a => new VendorVM


                                                                                                                                               //var x = _context.vendors.Where(a => a.vendor_id == id).Select(e => new
            {
                vendorname = a.ApplicationUser.UserName,
                instgram   = a.Instgram,
                facebook   = a.FacebookLink,
                twitter    = a.Twitterr,
                image      = a.ApplicationUser.ImageUrl,
                cat        = a.category.cat_Name,
            }).FirstOrDefault();

            if (!string.IsNullOrEmpty(vendorVM.image))
            {
                vendorVM.image = Process(vendorVM.image);
            }
            return(Ok(vendorVM));
        }
Example #18
0
        public ActionResult Edit(VendorVM model)
        {
            if (db.vendors.Where(x => x.Id != model.Id).Any(x => x.Title == model.Title))
            {
                ModelState.AddModelError("", "This Name Already exist");
                return(View(model));
            }

            if (ModelState.IsValid)
            {
                Vendor vendor = db.vendors.Where(x => x.Id.Equals(model.Id)).FirstOrDefault();

                vendor.Title    = model.Title;
                vendor.Location = model.Location;
                vendor.IsActive = model.IsActive;

                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Example #19
0
        public ActionResult DeleteConfirmed(int id)
        {
            Vendor vendor = db.vendors.Find(id);

            if (db.collections.Any(x => x.VendorId.Equals(id)))
            {
                ModelState.AddModelError("", "There are collections attached to this vendor, you must delete collections first or assign them to another vendor");
                VendorVM model = new VendorVM
                {
                    Id       = vendor.Id,
                    Title    = vendor.Title,
                    Location = vendor.Location,
                    IsActive = vendor.IsActive
                };

                return(View(model));
            }

            db.vendors.Remove(vendor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #20
0
        public ActionResult Create(VendorVM model)
        {
            if (ModelState.IsValid)
            {
                //Look for existing vendors
                if (db.vendors.Any(x => x.Title.Equals(model.Title)))
                {
                    ModelState.AddModelError("", "Sorry, this vendor name already exists");
                    return(View(model));
                }

                Vendor vendor = new Vendor();

                vendor.Title    = model.Title;
                vendor.Location = model.Location;
                vendor.IsActive = model.IsActive;

                db.vendors.Add(vendor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Example #21
0
        public HttpResponseMessage Create(HttpRequestMessage request)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No items found");
                if (true)
                {
                    var model = new VendorVM();
                    PrepareVendorModel(model, null, false, true);

                    //default values
                    model.PageSize = 6;
                    model.Active = true;
                    model.AllowCustomersToSelectPageSize = true;
                    model.PageSizeOptions = _vendorSettings.DefaultVendorPageSizeOptions;

                    //default value
                    model.Active = true;

                    response = request.CreateResponse <VendorVM>(HttpStatusCode.OK, model);
                }
                return response;
            }));
        }
        public async Task <ActionResult> Edit(VendorVM model)
        {
            if (_db.Vendors.IsExistSmsNumber(model.VendorID, model.SmsNumber))
            {
                ModelState.AddModelError("SmsNumber", "SMS Number Already exist");
            }

            if (!ModelState.IsValid)
            {
                return(View(Request.IsAjaxRequest() ? "_Edit" : "Edit", model));
            }

            _db.Vendors.UpdateCustom(model);
            var task = await _db.SaveChangesAsync();

            if (task != 0)
            {
                return(Request.IsAjaxRequest() ? (ActionResult)Content("success") : RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Unable to update");
            Response.StatusCode = (int)HttpStatusCode.BadRequest;
            return(View(Request.IsAjaxRequest() ? "_Edit" : "Edit", model));
        }
Example #23
0
        // GET: Admin/Vendor/Create
        public ActionResult Create()
        {
            VendorVM model = new VendorVM();

            return(View(model));
        }
Example #24
0
        public HttpResponseMessage EditVendor(HttpRequestMessage request, VendorVM model, bool continueEditing = false)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No items found");
                if (true)
                {
                    var vendor = _vendorService.GetVendorById(model.Id);
                    if (vendor == null || vendor.Deleted)
                    {
                        //No customer role found with the specified id
                        string uri = Url.Link("VendorList", null);
                        response.Headers.Location = new Uri(uri);
                        return response;
                    }

                    try
                    {
                        if (ModelState.IsValid)
                        {
                            int prevPictureId = vendor.PictureId;
                            vendor = model.ToEntity(vendor);
                            _vendorService.UpdateVendor(vendor);

                            //activity log
                            _customerActivityService.InsertActivity("EditVendor", _localizationService.GetResource("ActivityLog.EditVendor"), vendor.Id);

                            //search engine name
                            //model.SeName = vendor.ValidateSeName(model.SeName, vendor.Name, true, _urlRecordService, _seoSettings);
                            //_urlRecordService.SaveSlug(vendor, model.SeName, 0);

                            //address
                            var address = _addressService.GetAddressById(vendor.AddressId);
                            if (address == null)
                            {
                                address = model.Address.ToEntity();
                                address.CreatedOnUtc = DateTime.UtcNow;
                                //some validation
                                if (address.CountryId == 0)
                                {
                                    address.CountryId = null;
                                }
                                if (address.StateProvinceId == 0)
                                {
                                    address.StateProvinceId = null;
                                }

                                _addressService.InsertAddress(address);
                                vendor.AddressId = address.Id;
                                _vendorService.UpdateVendor(vendor);
                            }
                            else
                            {
                                address = model.Address.ToEntity(address);
                                //some validation
                                if (address.CountryId == 0)
                                {
                                    address.CountryId = null;
                                }
                                if (address.StateProvinceId == 0)
                                {
                                    address.StateProvinceId = null;
                                }

                                _addressService.UpdateAddress(address);
                            }


                            //locales
                            UpdateLocales(vendor, model);
                            //delete an old picture (if deleted or updated)
                            if (prevPictureId > 0 && prevPictureId != vendor.PictureId)
                            {
                                var prevPicture = _pictureService.GetPictureById(prevPictureId);
                                if (prevPicture != null)
                                {
                                    _pictureService.DeletePicture(prevPicture);
                                }
                            }
                            //update picture seo file name
                            UpdatePictureSeoNames(vendor);

                            _baseService.Commit();
                            response = request.CreateResponse <VendorVM>(HttpStatusCode.OK, model);
                            //SuccessNotification(_localizationService.GetResource("Admin.Vendors.Updated"));
                            if (continueEditing)
                            {
                                // Generate a link to the update item and set the Location header in the response.
                                string uri = Url.Link("GetVendorById", new { id = vendor.Id });
                                response.Headers.Location = new Uri(uri);
                            }
                            else
                            {
                                string uri = Url.Link("VendorList", null);
                                response.Headers.Location = new Uri(uri);
                                RedirectToRoute("VendorList", new { pageIndex = 1, pageSize = 57788, showHidden = true });
                            }
                            return response;
                        }

                        //If we got this far, something failed, redisplay form
                        PrepareVendorModel(model, vendor, true, true);
                        response = request.CreateResponse <VendorVM>(HttpStatusCode.OK, model);
                        return response;
                    }
                    catch (Exception exc)
                    {
                        LogError(exc);
                        string uri = Url.Link("GetVendorById", new { id = vendor.Id });
                        response.Headers.Location = new Uri(uri);
                        return response;
                    }
                }
                return response;
            }));
        }
Example #25
0
        public static bool Insert_Vendor(VendorVM model, string dealerCode)
        {
            string csgNo;

            try
            {
                if (model.VendorCode == "" || model.VendorCode == null)
                {
                    strAutoCode = sysfun.GetNewMaxID("Vendor", "VendorCode", 6, dealerCode);
                }

                else
                {
                    strAutoCode = model.VendorCode;
                }
                SqlParameter[] param =
                {
                    new SqlParameter("@DealerCode", dealerCode),          //0
                    new SqlParameter("@VendorCode", strAutoCode),         //1
                    new SqlParameter("@VendorDesc", model.VendorDesc),    //2
                    // new SqlParameter("@FatherHusName",(object)DBNull.Value),//3
                    new SqlParameter("@Add1", model.Add1),                //4
                    new SqlParameter("@Add2", (object)DBNull.Value),      //5
                    new SqlParameter("@Add3", (object)DBNull.Value),      //6
                    new SqlParameter("@ContPerson", model.ContPerson),    //7
                    new SqlParameter("@PaymentTerm", model.PaymentTerm),  //8
                    new SqlParameter("@CreditLimit", model.CreditLimit),  //9
                    // new SqlParameter("@NIC",model.NIC),//10
                    //  new SqlParameter("@VendorType",model.VendorType),//11
                    // new SqlParameter("@DOB",(object)DBNull.Value ),//12
                    new SqlParameter("@Phone1", model.Phone1),                                //13
                    new SqlParameter("@Phone2", model.Phone2),                                //14
                    //  new SqlParameter("@CellNo",model.CellNo),//15
                    new SqlParameter("@Fax", model.Fax),                                      //16
                    new SqlParameter("@Email", model.Email),                                  //17
                    new SqlParameter("@URL", model.URL),                                      //18
                    new SqlParameter("@NTN", model.NTN),                                      //19
                    //  new SqlParameter("@AdvanceReceipt",(object)DBNull.Value ),//20
                    new SqlParameter("@UpdUser", AuthBase.UserId),                            //21
                    new SqlParameter("@UpdTerm", General.CurrentIP),                          //22
                    new SqlParameter("@GSTno", model.GSTno),                                  //23
                    // new SqlParameter("@Behavior",(object)DBNull.Value),//24
                    // new SqlParameter("@Remarks",(object)DBNull.Value),//25
                    // new SqlParameter("@Distance",model.Distance),//26
                    // new SqlParameter("@CountryCode", model.CountryCode),//27
                    // new SqlParameter("@CityCode", model.CityCode),//28
                    // new SqlParameter("@StateCode", model.StateCode),//29
                    new SqlParameter("@Title", model.Title),                                       //30
                    //  new SqlParameter("@CSGNo", csgNo),//31
                    //   new SqlParameter("@MCNo", model.MCNo),//32
                    new SqlParameter("@AccountCode", model.AccountCode),            // 33
                    new SqlParameter("@VendorRecievable", model.VendorRecievable),  // 34
                    new SqlParameter("@VendorPayable", model.VendorPayable)         // 35
                };

                if (sysfun.ExecuteSP_NonQuery("sp_Insert_VendorNew", param))
                {
                    IsSaved = true;
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            return(IsSaved);
        }
Example #26
0
        protected virtual void PrepareVendorModel(VendorVM model, Vendor vendor, bool excludeProperties, bool prepareEntireAddressModel)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var address = _addressService.GetAddressById(vendor != null ? vendor.AddressId : 0);

            if (vendor != null)
            {
                if (!excludeProperties)
                {
                    if (address != null)
                    {
                        model.Address = address.ToModel();
                    }
                }

                //associated customer emails
                model.AssociatedCustomers = _customerService
                                            .GetAllCustomers(vendorId: vendor.Id)
                                            .Select(c => new VendorVM.AssociatedCustomerInfo()
                {
                    Id    = c.Id,
                    Email = c.Email
                })
                                            .ToList();
            }

            if (prepareEntireAddressModel)
            {
                model.Address.CountryEnabled        = true;
                model.Address.StateProvinceEnabled  = true;
                model.Address.CityEnabled           = true;
                model.Address.StreetAddressEnabled  = true;
                model.Address.StreetAddress2Enabled = true;
                model.Address.ZipPostalCodeEnabled  = true;
                model.Address.PhoneEnabled          = true;
                model.Address.FaxEnabled            = true;

                //address
                model.Address.AvailableCountries.Add(new System.Web.Mvc.SelectListItem {
                    Text = _localizationService.GetResource("Admin.Address.SelectCountry"), Value = "0"
                });
                foreach (var c in _countryService.GetAllCountries(showHidden: true))
                {
                    model.Address.AvailableCountries.Add(new System.Web.Mvc.SelectListItem {
                        Text = c.Name, Value = c.Id.ToString(), Selected = (address != null && c.Id == address.CountryId)
                    });
                }

                var states = model.Address.CountryId.HasValue ? _stateProvinceService.GetStateProvincesByCountryId(model.Address.CountryId.Value, showHidden: true).ToList() : new List <StateProvince>();
                if (states.Any())
                {
                    foreach (var s in states)
                    {
                        model.Address.AvailableStates.Add(new System.Web.Mvc.SelectListItem {
                            Text = s.Name, Value = s.Id.ToString(), Selected = (address != null && s.Id == address.StateProvinceId)
                        });
                    }
                }
                else
                {
                    model.Address.AvailableStates.Add(new System.Web.Mvc.SelectListItem {
                        Text = _localizationService.GetResource("Admin.Address.OtherNonUS"), Value = "0"
                    });
                }
            }
        }
Example #27
0
 private static string GetTitle(VendorVM model)
 {
     return(Htmls.CommonTitle(model.Vendor.Name));
 }
Example #28
0
 public static Vendor ToEntity(this VendorVM model)
 {
     return(model.MapTo <VendorVM, Vendor>());
 }
Example #29
0
 public static Vendor ToEntity(this VendorVM model, Vendor destination)
 {
     return(model.MapTo(destination));
 }