예제 #1
0
        public IActionResult SaveBranch(AddBranchVM model)
        {
            var newone = new Branch
            {
                BranchName  = model.branchName,
                CityID      = model.cityID,
                PhoneNumber = model.phoneNumber,
                Adress      = model.adress,
                Open        = model.open,
                Close       = model.close
            };

            _branch.AddBranch(newone);

            return(Redirect("/Branch/ShowAllBranches"));
        }
예제 #2
0
        public IActionResult AddBranch()
        {
            var model = new AddBranchVM
            {
                _cities = _context.city.Select(e => new Microsoft.AspNetCore.Mvc.Rendering.SelectListItem
                {
                    Value = e.CityID.ToString(),
                    Text  = e.CityName
                }).ToList()
            };

            _context.Add(new AdminActivity
            {
                ActivityID     = 9,
                AdminID        = Int32.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier)),
                DateOfActivity = DateTime.Now
            });
            _context.SaveChanges();
            return(View(model));
        }