public async Task <IActionResult> EditPosition(CurrentWPViewModel model)
        {
            ViewBag.Workers     = _dbContext.Workers;
            ViewBag.Companies   = _dbContext.Companies;
            ViewBag.Departments = _dbContext.Departments;
            ViewBag.Shops       = _dbContext.Shops;
            ViewBag.Positions   = _dbContext.Positions;

            if (ModelState.IsValid)
            {
                CurrentWorkPlace current = new CurrentWorkPlace()
                {
                    Id           = model.Id,
                    WorkerId     = model.WorkerId,
                    CompanyId    = model.CompanyId,
                    Company      = model.Company,
                    DepartmentId = model.DepartmentId,
                    ShopId       = model.ShopId,
                    PositionId   = model.PositionId,
                    EntryDate    = model.EntryDate,
                    ExitDate     = model.ExitDate
                };

                if (model.ExitDate != null)
                {
                    PreviousWorkPlace previous = new PreviousWorkPlace()
                    {
                        WorkerId            = current.WorkerId,
                        WorkPlaceName       = "Sinteks",
                        ReasonOfTermination = "Vəzifə dəyişikliyi",
                        EntryDate           = current.EntryDate,
                        ExitDate            = DateTime.Now
                    };
                    await _dbContext.PreviousWorkPlaces.AddAsync(previous);

                    _dbContext.CurrentWorkPlaces.Remove(current);
                    await _dbContext.SaveChangesAsync();

                    return(RedirectToAction("Previous", "Workplace"));
                }
            }
            return(View());
        }
        public async Task <IActionResult> AddPrevious(PreviousWPViewModel model)
        {
            if (ModelState.IsValid)
            {
                PreviousWorkPlace previous = new PreviousWorkPlace()
                {
                    Id                  = model.Id,
                    WorkPlaceName       = model.WorkPlaceName,
                    WorkerId            = model.WorkerId,
                    EntryDate           = model.EntryDate,
                    ExitDate            = model.ExitDate,
                    ReasonOfTermination = model.ReasonOfTermination
                };

                await _dbContext.PreviousWorkPlaces.AddAsync(previous);

                await _dbContext.SaveChangesAsync();

                return(RedirectToAction(nameof(Previous)));
            }

            return(View());
        }