public IActionResult Put(int id, [FromBody] TeethDto dto, [FromServices] UpdateTeethValidator validator) { dto.Id = id; var tooth = _context.Teeth.Find(id); if (tooth == null) { return(NotFound()); } var result = validator.Validate(dto); if (!result.IsValid) { throw new Exception();// prepraviti sa klasom error/ medelja 5-subota termin } _mapper.Map(dto, tooth); try { _context.SaveChanges(); return(NoContent()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError)); } }
public void Execute(JawDto request) { _validator.ValidateAndThrow(request); var jaw = _context.Jaws.Find(request.Id); jaw.JawName = request.JawName; _context.SaveChanges(); }
public void Execute(JawJawSideToothDto request) { var jawSide = _context.JawJawSideTeeth.Find(request.Id); jawSide.JawId = request.JawId; jawSide.JawSideId = request.JawSideId; jawSide.ToothId = request.ToothId; _context.SaveChanges(); }
public void Execute(DentistDto request) { _validator.ValidateAndThrow(request); var dentist = _context.Dentists.Find(request.Id); dentist.FirstName = request.FirstName; dentist.LastName = request.LastName; _context.SaveChanges(); }
public void Execute(TeethDto request) { _validator.ValidateAndThrow(request); var teeth = _context.Teeth.Find(request.Id); teeth.ToothNumber = request.ToothNumber; _context.SaveChanges(); }
public void Execute(RoleDto request) { _validator.ValidateAndThrow(request); var role = _context.Roles.Find(request.Id); role.RoleName = request.RoleName; _context.SaveChanges(); }
public void Execute(JawSideDto request) { _validator.ValidateAndThrow(request); var jawSide = new JawSide { JawSideName = request.JawSideName }; _context.JawSides.Add(jawSide); _context.SaveChanges(); }
public void Execute(RoleDto request) { _validator.ValidateAndThrow(request); var role = new Role { RoleName = request.RoleName }; _context.Roles.Add(role); _context.SaveChanges(); }
public void Execute(JawJawSideToothDto request) { var jawSideTooth = new JawJawSideTooth { JawId = request.JawId, JawSideId = request.ToothId, ToothId = request.ToothId }; _context.JawJawSideTeeth.Add(jawSideTooth); _context.SaveChanges(); }
public void Execute(TeethDto request) { _validator.ValidateAndThrow(request); var tooth = new Teeth { ToothNumber = request.ToothNumber }; _context.Teeth.Add(tooth); _context.SaveChanges(); }
public void Execute(ContactDto request) { _validator.ValidateAndThrow(request); var contact = _context.Contact.Find(request.Id); contact.Email = request.Email; contact.Phone = request.Phone; contact.Address = request.Address; contact.Fax = request.Fax; _context.SaveChanges(); }
public void Execute(ServiceTypeDto request) { _validator.ValidateAndThrow(request); var service = _context.ServiceTypes.Find(request.Id); service.ServiceName = request.ServiceName; service.ServiceDescription = request.ServiceDescription; service.ServicePrice = request.ServicePrice; _context.SaveChanges(); }
public void Execute(JawDto request) { _validator.ValidateAndThrow(request); var jaw = new Jaw { JawName = request.JawName }; _context.Jaws.Add(jaw); _context.SaveChanges(); }
public void Execute(ServiceTypeDto request) { _validator.ValidateAndThrow(request); _context.ServiceTypes.Add(new ServiceType { ServiceName = request.ServiceName, ServiceDescription = request.ServiceDescription, ServicePrice = request.ServicePrice }); _context.SaveChanges(); }
public void Execute(EKartonDto request) { _validator.ValidateAndThrow(request); var eKarton = _context.EKarton.Find(request.Id); eKarton.Date = request.Date; eKarton.UserId = request.UserId; eKarton.JawJawSideToothId = request.JawJawSideToothId; eKarton.Price = request.Price; eKarton.ServiceTypeId = request.ServiceTypeId; _context.SaveChanges(); }
public void Execute(AppointmentDto request) { _validator.ValidateAndThrow(request); var appointment = _context.Appointments.Find(request.Id); appointment.Email = request.Email; appointment.Phone = request.Phone; appointment.Date = request.Date; appointment.Time = request.Time; appointment.ServiceTypeId = request.ServiceTypeId; _context.SaveChanges(); }
public void Execute(DentistDto request) { _validator.ValidateAndThrow(request); var dentist = new Dentist { FirstName = request.FirstName, LastName = request.LastName }; _context.Dentists.Add(dentist); _context.SaveChanges(); }
public void Execute(EKartonDto request) { _validator.ValidateAndThrow(request); var ekarton = new EKarton { Date = request.Date, Price = request.Price }; _context.EKarton.Add(ekarton); _context.SaveChanges(); }
public void Execute(int request) { var jawSide = _context.JawSides.Find(request); if (jawSide == null) { throw new EntityNotFoundException(request, typeof(JawSide)); } jawSide.IsDeleted = true; jawSide.DeletedAt = DateTime.UtcNow; jawSide.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var dentist = _context.Dentists.Find(request); if (dentist == null) { throw new EntityNotFoundException(request, typeof(Dentist)); } dentist.IsDeleted = true; dentist.DeletedAt = DateTime.UtcNow; dentist.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var contact = _context.Contact.Find(request); if (contact == null) { throw new EntityNotFoundException(request, typeof(Contact)); } contact.IsDeleted = true; contact.DeletedAt = DateTime.UtcNow; contact.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var appointment = _context.Appointments.Find(request); if (appointment == null) { throw new EntityNotFoundException(request, typeof(Appointment)); } appointment.IsDeleted = true; appointment.DeletedAt = DateTime.UtcNow; appointment.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var user = _context.Users.Find(request); if (user == null) { throw new EntityNotFoundException(request, typeof(User)); } user.IsDeleted = true; user.DeletedAt = DateTime.UtcNow; user.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var serviceType = _context.ServiceTypes.Find(request); if (serviceType == null) { throw new EntityNotFoundException(request, typeof(ServiceType)); } serviceType.IsDeleted = true; serviceType.DeletedAt = DateTime.UtcNow; serviceType.IsActive = false; _context.SaveChanges(); }
public void Execute(UserDto request) { _validator.ValidateAndThrow(request); var user = _context.Users.Find(request.Id); user.FirstName = request.FirstName; user.LastName = request.LastName; user.Email = request.Email; user.Password = request.Password; user.Phone = request.Phone; user.RoleId = request.RoleId; _context.SaveChanges(); }
public void Execute(int id) { var role = _context.Roles.Find(id); if (role == null) { throw new EntityNotFoundException(id, typeof(Role)); } role.IsDeleted = true; role.DeletedAt = DateTime.UtcNow; role.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var teeth = _context.Teeth.Find(request); if (teeth == null) { throw new EntityNotFoundException(request, typeof(Teeth)); } teeth.IsDeleted = true; teeth.DeletedAt = DateTime.UtcNow; teeth.IsActive = false; _context.SaveChanges(); }
public void Execute(int request) { var eKarton = _context.EKarton.Find(request); if (eKarton == null) { throw new EntityNotFoundException(request, typeof(EKarton)); } eKarton.IsDeleted = true; eKarton.DeletedAt = DateTime.UtcNow; eKarton.IsActive = false; _context.SaveChanges(); }
public void Execute(ContactDto request) { _validator.ValidateAndThrow(request); var contact = new Contact { Address = request.Address, Phone = request.Phone, Fax = request.Fax, Email = request.Email }; _context.Contact.Add(contact); _context.SaveChanges(); }
public void Execute(AppointmentDto request) { _validator.ValidateAndThrow(request); var appointment = new Appointment { FirstNameLastName = request.FirstNameLastName, Email = request.Email, Phone = request.Phone, Date = DateTime.UtcNow, Time = request.Time }; //var appointment = _mapper.Map<Appointment>(request); _context.Appointments.Add(appointment); _context.SaveChanges(); }