public IActionResult Put(int id, [FromBody] User user) { if (_userRepository.Update(id, user)) { return(Ok()); } else { return(NotFound()); } }
public IActionResult Put(int id, [FromBody] Event e) { if (_eventRepository.Update(id, e)) { return(Ok()); } else { return(NotFound()); } }
private void Update() { string oldName = Entity.Name; string oldType = Entity.Type; string oldOrganizer = Entity.Organizer; DateTime?oldDate = Entity.Date; string oldLocation = Entity.Location; int? oldTickets = Entity.Tickets; double? oldPrice = Entity.Price; string oldDescription = Entity.Description; Entity.Name = Name; Entity.Type = Type; Entity.Organizer = Organizer; Entity.Date = Date; Entity.Location = Location; Entity.Tickets = Tickets; Entity.Price = Price; Entity.Description = Description; _eventRequester.Update(Id, Entity); UpdateCommand.RaiseCanExecuteChanged(); if (!_eventRequester.Update(Id, Entity)) { Entity.Name = oldName; Entity.Type = oldType; Entity.Organizer = oldOrganizer; Entity.Date = oldDate; Entity.Location = oldLocation; Entity.Tickets = oldTickets; Entity.Price = oldPrice; Entity.Description = oldDescription; } EventWindow eventWindow = App.Current.Windows.OfType <EventWindow>().FirstOrDefault(); eventWindow.Close(); //ew.Close(); }
private void Update() { string oldLastName = Entity.LastName; string oldFirstName = Entity.FirstName; string oldScreenName = Entity.ScreenName; string oldEmail = Entity.Email; //string oldPasswd = Entity.Passwd; string oldAddress = Entity.Address; bool oldIsActive = Entity.IsActive; bool oldIsAdmin = Entity.IsAdmin; Entity.LastName = LastName; Entity.FirstName = FirstName; Entity.ScreenName = ScreenName; Entity.Email = Email; //Entity.Passwd = Passwd; Entity.Address = Address; Entity.IsActive = IsActive; Entity.IsAdmin = IsAdmin; UpdateCommand.RaiseCanExecuteChanged(); if (!_eventRequester.Update(Id, Entity)) { Entity.LastName = oldLastName; Entity.FirstName = oldFirstName; Entity.ScreenName = oldScreenName; Entity.Email = oldEmail; //Entity.Passwd = oldPasswd; Entity.Address = oldAddress; Entity.IsActive = oldIsActive; Entity.IsAdmin = oldIsAdmin; } //uw.Close(); }