public int Create(ServiceDTO newService)
        {
            var service = _mapper.Map <ServiceEntity>(newService);

            _context.Add(service);
            _context.SaveChanges();
            return(service.Id);
        }
Exemple #2
0
        public void Update(SettingDTO newSetting)
        {
            var setting = _context.MedcenterAppSettings.Where(s => s.Name.Equals(newSetting.Name)).FirstOrDefault();

            if (setting is null)
            {
                throw new MedcenterAppSettingsNotFoundException();
            }

            setting.Value = newSetting.Value;
            _context.SaveChanges();
        }
Exemple #3
0
        public void ChangePassword(string current, string @new)
        {
            var user = _context.Users.Where(u => u.Login.Equals("admin.medcenter")).First();

            if (!user.Password.Equals(current))
            {
                throw new IncorrectOldPasswordException("senha atual incorreta");
            }

            user.Password = @new;
            _context.SaveChanges();
        }