Пример #1
0
        public IActionResult Create()
        {
            var model = new LocationEmployeeCreateViewModel();

            ViewBag.listPos = _positionService.GetAll();
            ViewBag.listEMP = _employeeService.GetAll();
            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> Create(LocationEmployeeCreateViewModel model)
        {
            if (ModelState.IsValid)
            {
                var locationemployee = new LocationEmployee
                {
                    DateJoinedLocation  = DateTime.Now,
                    EmployeeId          = model.EmployeeId,
                    LocationId          = model.LocationId,
                    Status              = true,
                    StatusJoindLocation = true
                };

                await _locationEmployeeService.CreateAsync(locationemployee);

                return(RedirectToAction("Create"));
            }
            return(View());
        }