public UpdateResult Update(ObjectId Id, SimpleCourseDTO course) { var filter = Builders <Course> .Filter.Eq("Id", Id); var update = Builders <Course> .Update.Set("Name", course.Name).Set("Code", course.Code); return(_collection.UpdateOne(filter, update)); }
public ActionResult <Course> Post([FromBody] SimpleCourseDTO courseDto) { var course = new Course { Id = ObjectId.GenerateNewId(), Name = courseDto.Name, Code = courseDto.Code }; _courseRepository.Add(course); return(course); }
public ActionResult <UpdateResult> Put(string id, [FromBody] SimpleCourseDTO course) { var OId = ObjectId.Parse(id); return(this._courseRepository.Update(OId, course)); }