public int AddStudentSemester(int id, StudentSemesterCreateModel model) { if (model == null || model.Id <= 0) { return(0); } var affectedRows = this.repository.AddStudentSemester(id, model.Id); return(affectedRows); }
public IActionResult AddStudentSemester(int id, [FromBody] StudentSemesterCreateModel model) { if (!this.Validator.ValidateId(id) || !this.Validator.ValidateObject(model) || !this.Validator.ValidateId(model.Id)) { return(BadRequest(new { message = "Bad parameters passed!" })); } var affectedRows = this.service.AddStudentSemester(id, model); return(this.BuildNonQueryResponse(affectedRows)); }