public IHttpActionResult Post([FromBody] ConcertProgrammModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userId = User.Identity.GetUserId <int>(); return(Ok(_concertService.SaveConcertProgramm(model).Response())); }
/// <see cref="IConcertService.SaveConcertProgramm(ConcertProgrammModel)"/> public ServiceResponce SaveConcertProgramm(ConcertProgrammModel model) { var succes = ServiceResponce.FromSuccess().Result("Concert programm save complete"); var error = ServiceResponce.FromFailed().Result($"Error save concert programm"); var res = _concertRepository.AddConcertProgramm( ConcertModelHelper.GetProgramm(model)); if (res != null) { succes.Add("ProgrammId", res.Id); } return(res != null ? succes : error); }
public static ConcertProgramm GetProgramm(ConcertProgrammModel model) { return(model != null ? new ConcertProgramm { Id = model.Id, Name = model.Name, DateStart = model.DateStart, DateEnd = model.DateEnd, Duration = model.Duration, TimeStart = model.TimeStart, TimeEnd = model.TimeEnd, Description = model.Description, IdEvent = model.IdEvent, MediaLink = model.MediaLink, //Actors = model.Actors != null ? GetActors(model.Actors).ToList(): null } : null); }
/// <see cref="IConcertService.UpdateConcertProgramm"/> public bool UpdateConcertProgramm(ConcertProgrammModel model) { return(_concertRepository.UpdateConcertProgramm(ConcertModelHelper.GetProgramm(model)) != null); }