public Model.Korisnici Insert(KorisniciInsertRequest request) { request.IsDeleted = false; byte[] data = System.Convert.FromBase64String(request.Password); request.Password = System.Text.ASCIIEncoding.ASCII.GetString(data); byte[] data2 = System.Convert.FromBase64String(request.PasswordConfirmation); request.PasswordConfirmation = System.Text.ASCIIEncoding.ASCII.GetString(data2); var entity = _mapper.Map <Database.Korisnici>(request); if (request.Password != request.PasswordConfirmation) { throw new UserException("Passwordi se ne slazu!"); } entity.LozinkaSalt = GenerateSalt(); entity.LozinkaHash = GenerateHash(entity.LozinkaSalt, request.Password); _context.Korisnici.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Korisnici>(entity)); }
public Model.Postavke Insert(PostavkeInsertRequest request) { var entity = _mapper.Map <Database.Postavke>(request); _context.Postavke.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Postavke>(entity)); }
public Model.Fajlovi Insert(FajloviInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.FajloviPredmeta>(request); _context.FajloviPredmeta.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Fajlovi>(entity)); }
public Model.RadniSati Insert(RadniSatiInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.RadniSati>(request); _context.RadniSati.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.RadniSati>(entity)); }
public Model.ZapisnikRocista Insert(ZapisnikRocistaInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.ZapisnikRocista>(request); _context.ZapisnikRocista.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.ZapisnikRocista>(entity)); }
public Model.Kontaktlista Insert(KontaktlistaInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.ListaKontakata>(request); _context.ListaKontakata.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Kontaktlista>(entity)); }
public Model.KategorijeDokumenata Insert(KategorijeDokumenataInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.KategorijeDokumenata>(request); _context.KategorijeDokumenata.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.KategorijeDokumenata>(entity)); }
public Model.Ured Insert(UredInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.Ured>(request); _context.Uredi.Add(entity); _context.SaveChanges(); return(_mapper.Map <Model.Ured>(entity)); }
public Model.Zadaci Insert(ZadaciInsertRequest request) { request.IsDeleted = false; var entity = _mapper.Map <Database.Zadaci>(request); _context.Zadaci.Add(entity); _context.SaveChanges(); var query = _context.Zadaci.AsQueryable().Include(c => c.Zaposlenici).Where(x => x.ZaposleniciId.Equals(request.ZaposleniciId)); var temp = query.FirstOrDefault(); string subject = "Zadatak"; string body = "Novi zadatak je dodan u vaš kalendar."; string FromMail = "*****@*****.**"; //string FromMail = "*****@*****.**"; string emailFormAdvokat = temp.Zaposlenici.Email; string emailTo = emailFormAdvokat; MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress(FromMail); mail.To.Add(emailTo); mail.Subject = subject; mail.Body = body; SmtpServer.Port = 587; SmtpServer.UseDefaultCredentials = false; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Rstest123456"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); return(_mapper.Map <Model.Zadaci>(entity)); }