public void UpdateDonation() { if (Donation.ValidValues() && Donation != null) { Donation.UpdateDonation(); MessageBox.Show("Upraveno."); Filter(); } else { MessageBox.Show("Vyplňte prosím název, hodnotu a datum."); } }
public HttpResponseMessage Create(HttpRequestMessage request, DonationViewModel controPanelVM) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; if (!ModelState.IsValid) { response = request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } else { Donation newDonation = new Donation(); newDonation.UpdateDonation(controPanelVM); newDonation.CreatedDate = DateTime.Now; newDonation.CreatedBy = User.Identity.Name; var page = _donationService.Add(newDonation); _donationService.Save(); response = request.CreateResponse(HttpStatusCode.Created, page); } return response; })); }