public HttpResponseMessage UpdateEvent(string userId, Event e) { throw new NotImplementedException(); }
public HttpResponseMessage UpdateEvent(Event item) { var match = this.context.Events.FirstOrDefault(e => e.Id == item.Id && e.User.Id == item.User.Id); if (match == null) { context.Events.Add(item); } else { match.Hours = item.Hours; match.Category = item.Category; match.Client = item.Client; match.CurrentStatus = item.CurrentStatus; match.Date = item.Date; match.Description = item.Description; } context.SaveChanges(); if (match == null) { return new HttpResponseMessage(HttpStatusCode.Created); } else { return new HttpResponseMessage(HttpStatusCode.OK); } }