public string Create(SalonViewModel model)  //yeni bir tane film tur ekleme yapar
        {
            try
            {
                SinemaOtomasyonuEntities db = new SinemaOtomasyonuEntities();
                Salon ft = null;
                if (model.SalonIDNumber > 0)
                {
                    ft = db.Salon.FirstOrDefault(f => f.SalonID == model.SalonIDNumber);
                }
                else
                {
                    ft = new Salon();
                }
                ft.SalonAd         = model.SalonAdNumber;
                ft.SalonKapasite   = model.SalonKapasiteNumber;
                ft.SalonSiraSayisi = model.SalonSiraSayisiNumber;
                ft.SeansID         = model.SeansIDNumber;



                if (model.SalonIDNumber == 0)
                {
                    db.Salon.Add(ft);
                }
                db.SaveChanges();
                return("1");
            }
            catch
            {
                return("-1");
            }
        }
Exemple #2
0
        public SalonView()
        {
            InitializeComponent();
            SalonViewModel modelo = new SalonViewModel(DialogCoordinator.Instance);

            this.DataContext = modelo;
        }
 public void RegisterSalonAccount(SalonViewModel newSalon)
 {
     if (newSalon != null)
     {
         var account = _accountRepo.Gets().Where(c => c.Id.Equals(newSalon.AccountId)).FirstOrDefault();
         if (account != null)
         {
             var salon = new Salon
             {
                 Name          = newSalon.SalonName,
                 AspNetUsers   = account,
                 Address       = newSalon.Address,
                 Email         = newSalon.Email,
                 Latitude      = 0,
                 Longitude     = 0,
                 RatingAverage = 0,
                 Phone         = newSalon.Phone,
                 IsForMen      = newSalon.IsForMen,
                 IsForWomen    = newSalon.IsForWomen,
             };
             _salonRepo.Insert(salon);
             _unitOfWork.SaveChanges();
         }
     }
 }
Exemple #4
0
 public IActionResult Update(SalonViewModel model)
 {
     if (model != null)
     {
         _salonService.UpdateProfile(model);
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Index()
        {
            SalonViewModel           model = new SalonViewModel();
            SinemaOtomasyonuEntities db    = new SinemaOtomasyonuEntities();

            ViewBag.SeansIDNumber = new SelectList(db.Seans, "SeansID", "SeansSaat");
            return(View(model));
        }
Exemple #6
0
        public string RegisterSalon(SalonViewModel model)
        {
            var   account = this.RegisterAccount(model.Username, model.Password, model.Email);
            Salon salon   = new Salon
            {
                Name    = model.Name,
                Address = model.Address,
                Phone   = model.Phone,
                Email   = model.Email
            };

            return(_authRepo.RegisterSalonAccount(account, salon));
        }
        public JsonResult SalonGetir(int id)
        {
            SinemaOtomasyonuEntities db = new SinemaOtomasyonuEntities();
            Salon          kullanici    = db.Salon.FirstOrDefault(f => f.SalonID == id);
            SalonViewModel model        = new SalonViewModel();

            model.SalonIDNumber         = kullanici.SalonID;
            model.SalonAdNumber         = kullanici.SalonAd;
            model.SalonKapasiteNumber   = kullanici.SalonKapasite;
            model.SalonSiraSayisiNumber = kullanici.SalonSiraSayisi;
            model.SeansIDNumber         = kullanici.SeansID;
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public IdentityResult SalonRegister(SalonAccountModel model)
        {
            IdentityResult result = null;

            try
            {
                var userStore = new UserStore <ApplicationUser>(new ApplicationDbContext());
                var manager   = new UserManager <ApplicationUser>(userStore);
                var user      = new ApplicationUser()
                {
                    UserName    = model.UserName,
                    Email       = model.Email,
                    PhoneNumber = model.PhoneNumber,
                };
                manager.PasswordValidator = new PasswordValidator()
                {
                    RequiredLength = 3
                };
                result = manager.Create(user, model.Password);
                if (result.Succeeded)
                {
                    var createRoleResult = manager.AddToRole(user.Id, RoleConstant.SALON);
                    if (createRoleResult.Succeeded)
                    {
                        var newSalon = new SalonViewModel
                        {
                            SalonName     = model.SalonName,
                            Address       = model.Address,
                            AccountId     = user.Id,
                            IsForMen      = model.IsForMen,
                            IsForWomen    = model.IsForWomen,
                            Phone         = model.PhoneNumber,
                            Email         = model.Email,
                            RatingAvarage = 0
                        };
                        _salonService.RegisterSalonAccount(newSalon);
                    }
                    else
                    {
                        manager.Delete(user);
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
                return(new IdentityResult("Cannot create salon account"));
            }
            return(result);
        }
 public void UpdateProfile(SalonViewModel model)
 {
     if (model != null)
     {
         var salon = _salonRepository.FindById(model.SalonId);
         if (salon != null)
         {
             salon.Name    = model.Name;
             salon.Phone   = model.Phone;
             salon.Address = model.Address;
             _salonRepository.Update(salon);
             _unitOfWork.Save();
         }
     }
 }
Exemple #10
0
 public void RegisterSalonAccount(SalonViewModel newSalon)
 {
     if (newSalon != null)
     {
         var salon = new Salon
         {
             Name          = newSalon.SalonName,
             AccountId     = newSalon.AccountId,
             Address       = newSalon.Address,
             RatingAverage = 0,
             IsForMen      = newSalon.IsForMen,
             IsForWomen    = newSalon.IsForWomen
         };
         _salonRepo.Insert(salon);
         _unitOfWork.SaveChanges();
     }
 }
Exemple #11
0
 public IActionResult SalonRegister(SalonViewModel model)
 {
     if (ModelState.IsValid)
     {
         string status = _authService.RegisterSalon(model);
         if (status.Equals("Success"))
         {
             ModelState.Clear();
             TempData["RegisterStatus"] = "Registration Successful!";
         }
         else
         {
             TempData["RegisterStatus"] = "Registration Failed ! Please try again";
         }
         return(View());
     }
     return(View());
 }