Ejemplo n.º 1
0
        public void AddVendorTest()
        {
            var serv = new VendorService(new MVCHContext());

            serv.AddVendor(new Vendor
            {
                Name = "Indoplas Philippines"
            });
            serv.AddVendor(new Vendor
            {
                Name = "Destiny Care Diagnostics Supplies"
            });
            serv.AddVendor(new Vendor
            {
                Name = "Medical Supplies Depot"
            });
            serv.AddVendor(new Vendor
            {
                Name = "Zenith Medical Equipment Inc."
            });
            serv.AddVendor(new Vendor
            {
                Name = "Taiwan Trade Inc."
            });
        }
Ejemplo n.º 2
0
        public JsonResult AddVendor(string name, string nick, int dni, DateTime birthDay)
        {
            try
            {
                dt           = service.AddVendor(name, nick, dni, birthDay, userNameLogin, userIdLogin);
                data.result  = JsonConvert.SerializeObject(dt, Formatting.Indented);
                data.message = "Se creó el vendedor con éxito";
            }
            catch (Exception ex)
            {
                data.message = ex.Message;
                data.status  = "error";
                return(Json(data, JsonRequestBehavior.AllowGet));
            }

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> RegisterVendor(VendorViewModel model)
        {
            //if (model.Gender != Gender.Male || model.Gender != Gender.Female) model.Gender
            if (ModelState.IsValid)
            {
                var randomNumber = new Random();
                model.Password = model.FirstName + "@P" + randomNumber.Next(1, 99999);

                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email, PhoneNumber = model.PhoneNumber
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    VendorMD vendor = new VendorMD();
                    vendor.FirstName    = model.FirstName;
                    vendor.LastName     = model.LastName;
                    vendor.Gender       = model.Gender;
                    vendor.DateOfJoin   = model.DateOfJoin;
                    vendor.DateOfBirth  = model.DateOfBirth;
                    vendor.Image        = "";
                    vendor.Id           = user.Id;
                    vendor.VendorTypeId = model.VendorTypeId;
                    vendor.CompanyId    = Convert.ToInt32(User.Identity.GetUserId());
                    vendor.CreatedById  = Convert.ToInt64(User.Identity.GetUserId());
                    vendor.CreatedDate  = DateTime.Now;

                    //vendor.IsValid = true;

                    var res = _vendorService.AddVendor(vendor);
                    if (res.HasErrors)
                    {
                        model.HasError = true;
                        //model.ErrorMessage.Message = res.ResultMessages.FirstOrDefault().Message;
                        //model.ErrorMessage.MessageType =  "Try again! " + res.ResultMessages.FirstOrDefault().MessageType;
                        await UserManager.DeleteAsync(user);
                    }

                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(View(model));
        }
Ejemplo n.º 4
0
 public async Task addVendor()
 {
     VendorService service = new VendorService();
     var           model   = new AddVendorModel()
     {
         Title       = "test",
         UserId      = Guid.NewGuid(),
         MainImage   = "test.jpg",
         CategoryId  = 10,
         Lng         = 51.2063269,
         Lat         = 35.6140752,
         PhoneNumber = "09123135143",
         Description = "توضیحات",
         Facilities  = new List <int>()
         {
             1, 2
         }
     };
     await service.AddVendor(model);
 }
Ejemplo n.º 5
0
        public ActionResult AddVendor(string vendorName)
        {
            vendorService.AddVendor(vendorName);

            return(null);
        }