Esempio n. 1
0
        public IActionResult Upsert(EmployeeSpecial employee)
        {
            if (ModelState.IsValid)
            {
                if (employee.Id == Guid.Empty)
                {
                    _unitOfWork.EmployeeSpecial.Add(employee);
                }
                else
                {
                    _unitOfWork.EmployeeSpecial.Update(employee);
                }

                _unitOfWork.Save();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(employee));
        }
Esempio n. 2
0
        public IActionResult Upsert(Guid id)
        {
            var employee = new EmployeeSpecial();

            if (id == Guid.Empty)
            {
                //this is for create
                employee.BirthDate = DateTime.Now.AddYears(-18);
                return(View(employee));
            }

            // this is for edit
            employee = _unitOfWork.EmployeeSpecial.Get(id);

            if (employee == null)
            {
                return(NotFound());
            }

            return(View(employee));
        }
Esempio n. 3
0
 private void onSpecialsChanged(EmployeeSpecial special)
 {
     addSpecial(special);
 }
Esempio n. 4
0
        private void addSpecial(EmployeeSpecial special)
        {
            var go = Instantiate(SpecialPrefab, specialContainer.transform, false);

            go.GetComponentInChildren <Text>().text = special.GetDisplayName();
        }