public void UpdateSportScheduleFE(sportScheduleFE entity) { if (entity == null) { throw new ArgumentNullException("entity"); } _repository.UpdateSportScheduleFE(entity); _unitOfWork.Commit(); }
public IHttpActionResult PostSportScheduleFE(sportScheduleFE entity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _service.CreateSportScheduleFE(entity); return(CreatedAtRoute("DefaultApi", new { controller = "SportScheduleController", id = entity.ModuleID }, entity)); }
public virtual void UpdateSportScheduleFE(sportScheduleFE entity) { /* * var original = context.Set<sportScheduleFE>().Where(e => e.ModuleID == entity.ModuleID).FirstOrDefault(); * entity.CreatedDate = original.CreatedDate; * context.Entry(original).CurrentValues.SetValues(entity); */ var sportScheduleFE = context.Set <sportScheduleFE>().Where(e => e.ModuleID == entity.ModuleID).FirstOrDefault(); sportScheduleFE.LeagueID = entity.LeagueID; }
public IHttpActionResult PutSportScheduleFE(int moduleId, sportScheduleFE entity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (moduleId != entity.ModuleID) { return(BadRequest()); } _service.UpdateSportScheduleFE(entity); return(StatusCode(HttpStatusCode.NoContent)); }
public virtual void CreateSportScheduleFE(sportScheduleFE entity) { if (entity == null) { throw new ArgumentNullException("entity"); } var sportScheduleFE = _repository.GetSportScheduleFE(entity.ModuleID); if (sportScheduleFE == null) { _repository.CreateSportScheduleFE(entity); } else { _repository.UpdateSportScheduleFE(entity); } _unitOfWork.Commit(); }
public virtual void CreateSportScheduleFE(sportScheduleFE entity) { entity.CreatedDate = DateTime.UtcNow; context.Set <sportScheduleFE>().Add(entity); }