public Model.Korisnici Insert(KorisniciInsertRequest request) { var entity = _mapper.Map <Database.Korisnici>(request); if (request.Password != request.PasswordPotvrda) { throw new UserException("Passwordi se ne slažu"); } entity.LozinkaSalt = GenerateSalt(); entity.LozinkaHash = GenerateHash(entity.LozinkaSalt, request.Password); if (request.Pacijent1 != null) { entity.Pacijent = _mapper.Map <Database.Pacijent>(request.Pacijent1); } _context.Korisnici.Add(entity); _context.SaveChanges(); foreach (var uloga in request.Uloge) { Database.KorisniciUloge korisniciUloge = new Database.KorisniciUloge { KorisnikId = entity.Id, UlogaId = uloga }; _context.KorisniciUloge.Add(korisniciUloge); } _context.SaveChanges(); return(_mapper.Map <Model.Korisnici>(entity)); }
public Model.Pregled Insert(PregledInsertRequest request) { var entity = _mapper.Map <Database.Pregled>(request); _context.Pregled.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Pregled>(entity)); }
public Model.Uputnica Insert(UputnicaInsertRequest request) { var entity = _mapper.Map <Database.Uputnica>(request); _context.Uputnica.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Uputnica>(entity)); }
public Model.Proizvodjac Insert(Model.Proizvodjac request) { var entity = _mapper.Map <Database.Proizvodjac>(request); _context.Proizvodjac.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Proizvodjac>(entity)); }
public Model.Lijek Insert(LijekInsertRequest request) { var entity = _mapper.Map <Database.Lijek>(request); _context.Lijek.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Lijek>(entity)); }
public Model.RacunStavka Insert(RacunStavkaInsertRequest request) { var entity = _mapper.Map <Database.RacunStavka>(request); _context.RacunStavka.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.RacunStavka>(entity)); }
public Model.Recept Insert(ReceptInsertRequest request) { var entity = _mapper.Map <Database.Recept>(request); _context.Recept.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Recept>(entity)); }
public Model.ApotekaRacun Insert(ApotekaRacunInsertRequest request) { var entity = _mapper.Map <Database.ApotekaRacun>(request); _context.ApotekaRacun.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.ApotekaRacun>(entity)); }
public Model.Narudzba Insert(NarudzbaInsertRequest request) { var entity = _mapper.Map <Database.Narudzba>(request); _context.Narudzba.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Narudzba>(entity)); }