public async Task <IActionResult> PostRadniSat(RadniSatiViewModel model) { var user = await _userService.GetUserByUserName(User.Identity.Name); model.UserId = user.Id; model.User = user.FirstName + " " + user.LastName; model.Aktivan = true; var data = _radniSati.PostRadniSati(model); return(Ok(data)); }
public RadniSatiViewModel PostRadniSati(RadniSatiViewModel model) { model.Id = Guid.NewGuid(); var datumunosa = DateTime.Now; model.DatumUnosa = datumunosa.ToString("dd/MM/yyyy HH:mm"); var radnisati = new RadniSati() { Id = model.Id.Value, DatumUnosa = datumunosa, UserId = model.UserId, ZadatakId = model.ZadatakId.Value, UtrosenoVrijeme = new TimeSpan(model.Sati, model.Minute, 0).Ticks }; _context.RadniSati.Add(radnisati); _context.SaveChanges(); return(model); }
public IActionResult DeleteRadniSat(RadniSatiViewModel model) { _radniSati.DeleteRadniSati(model.Id.Value); return(Ok()); }
public RadniSatiPage(int Klijent) { InitializeComponent(); KlijentId = Klijent; BindingContext = model = new RadniSatiViewModel(KlijentId); }