Esempio n. 1
0
        public int AddEducationDegrees(EducationDegrees data)
        {
            var checkNumber = _context.EducationDegrees.Any(x => x.educationId == data.educationId && x.academicDegreesId == data.academicDegreesId);

            if (checkNumber)
            {
                return(-1);
            }
            var res = _context.EducationDegrees.Add(data);

            _context.SaveChanges();
            return(res.Entity.Id);
        }
Esempio n. 2
0
        public static decimal CalculateForOne(vwManager manager, vwEmployee employee, int addition)
        {
            EducationDegrees degree = new EducationDegrees();
            decimal          i      = 0.75M * manager.ExperienceWorkingInHotels;
            decimal          s      = 0.15M * degree.levels[manager.ProfessionalQualifications];
            decimal          p      = 0;

            if (employee.Gender == "M")
            {
                p = 1.12M;
            }
            else
            {
                p = 1.15M;
            }
            return(1000 * i * s * p + addition);
        }
        public IActionResult PutEducationDegrees(int id, [FromBody] EducationDegrees data)
        {
            try
            {
                var res = _repository.UpdateEducationDegrees(id, data);

                if (!res)
                {
                    return(Conflict(409));
                }

                return(Ok(res));
            }
            catch (Exception error)
            {
                return(BadRequest(error));
            }
        }
        public IActionResult PostEducationDegrees(EducationDegrees data)
        {
            try
            {
                var res = _repository.AddEducationDegrees(data);

                if (res == -1)
                {
                    return(Conflict(409));
                }

                return(Ok(res));
            }
            catch (Exception error)
            {
                return(BadRequest(error));
            }
        }
Esempio n. 5
0
        public bool UpdateEducationDegrees(int id, EducationDegrees data)
        {
            var res = _context.EducationDegrees.FirstOrDefault(x => x.Id == id);

            if (res == null)
            {
                return(false);
            }
            var checkNumber = _context.EducationDegrees.Where(x => x.Id != id).Any(x => x.educationId == data.educationId && x.academicDegreesId == data.academicDegreesId);

            if (checkNumber)
            {
                return(false);
            }
            res.educationId       = data.educationId;
            res.academicDegreesId = data.academicDegreesId;
            _context.SaveChanges();
            return(true);
        }