public IHttpActionResult Post(DTO_PRO_HoiNghiHoiThao_DangKy tbl_PRO_HoiNghiHoiThaoDangKy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ApplicationUser user = UserManager.FindById(User.Identity.GetUserId()); if (user.StaffID <= 0) { return(BadRequest("Chưa thiết lập nhân sự, không thể đăng ký")); } tbl_PRO_HoiNghiHoiThaoDangKy.IDNhanVien = user.StaffID; DTO_PRO_HoiNghiHoiThao_DangKy result = BS_PRO_HoiNghiHoiThao_DangKy.post_PRO_HoiNghiHoiThao_DangKyCustom(db, tbl_PRO_HoiNghiHoiThaoDangKy, Username); if (result != null) { if (!string.IsNullOrEmpty(result.Error)) { return(BadRequest(result.Error)); } return(CreatedAtRoute("get_PRO_HoiNghiHoiThaoDangKy", new { id = result.ID }, result)); } return(Conflict()); }
public IHttpActionResult Get(int id) { DTO_PRO_HoiNghiHoiThao_DangKy tbl_PRO_HoiNghiHoiThaoDangKy = BS_PRO_HoiNghiHoiThao_DangKy.get_PRO_HoiNghiHoiThao_DangKy(db, id); if (tbl_PRO_HoiNghiHoiThaoDangKy == null) { return(NotFound()); } return(Ok(tbl_PRO_HoiNghiHoiThaoDangKy)); }
public IHttpActionResult Delete(int id) { bool check = BS_PRO_HoiNghiHoiThao_DangKy.check_PRO_HoiNghiHoiThao_DangKy_Exists(db, id); if (!check) { return(NotFound()); } bool result = BS_PRO_HoiNghiHoiThao_DangKy.delete_PRO_HoiNghiHoiThao_DangKy(db, id, Username); if (result) { return(StatusCode(HttpStatusCode.NoContent)); } return(Conflict()); }
public IHttpActionResult Put(int id, DTO_PRO_HoiNghiHoiThao_DangKy tbl_PRO_HoiNghiHoiThaoDangKy) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbl_PRO_HoiNghiHoiThaoDangKy.ID) { return(BadRequest()); } bool res = BS_PRO_HoiNghiHoiThao_DangKy.put_PRO_HoiNghiHoiThao_DangKy(db, id, tbl_PRO_HoiNghiHoiThaoDangKy, Username); if (res) { return(StatusCode(HttpStatusCode.NoContent)); } else { return(NotFound()); } }
public IQueryable <DTO_PRO_HoiNghiHoiThao> GetChuaDangKy() { ApplicationUser user = UserManager.FindById(User.Identity.GetUserId()); return(BS_PRO_HoiNghiHoiThao_DangKy.get_PRO_HoiNghiHoiThao_ChuaDangKy(db, QueryStrings, user.StaffID)); }
public IQueryable <DTO_PRO_HoiNghiHoiThao_DangKy> GetByHoiNghi(int idHoiNghi) { return(BS_PRO_HoiNghiHoiThao_DangKy.get_PRO_HoiNghiHoiThao_DangKyTheoHoiNghi(db, QueryStrings, idHoiNghi)); }