public void AddMany(HourCollectionEntryModel hourModel, string name) { foreach (var studenthour in hourModel.StudentsHour) { if (studenthour.HourId == -1) { Add( new HourEntryModel { AccountId = studenthour.AccountId, Hour = studenthour.Hour, ProjectId = hourModel.ProjectId, SectionId = hourModel.SectionId } , name); } else { Update(studenthour.HourId, new HourEntryModel { AccountId = studenthour.AccountId, Hour = studenthour.Hour, ProjectId = hourModel.ProjectId, SectionId = hourModel.SectionId }); } } }
public IHttpActionResult PostManyHours(HourCollectionEntryModel hourModel) { _hoursServices.AddMany(hourModel, HttpContext.Current.User.Identity.Name); return(Ok()); }