public HttpResponseMessage Insert(UserModel model) { bool result = repository.Insert(model); if (result) return new HttpResponseMessage(HttpStatusCode.NotModified); return new HttpResponseMessage(HttpStatusCode.OK); }
public IQueryable<UserModel> InsertRandom() { var model = new UserModel(); model.Email = string.Format("{0}@bilgiedu.net", System.IO.Path.GetRandomFileName()); model.Name = System.IO.Path.GetRandomFileName(); model.Password = new System.Random().Next(int.MaxValue).ToString(); model.Courses = new List<Domain.Course.CourseModel>(); for (int i = 0; i < new Random().Next(5); i++) { var courseModel = new Domain.Course.CourseModel(); courseModel.Name = string.Format("Comp_{0}", new Random().Next(100, 500)); courseModel.Place = string.Format("D.{0}", new Random().Next(100, 600)); courseModel.StartDate = DateTime.Now; model.Courses.Add(courseModel); } Insert(model); return GetList(); }