// GET: api/Api_BangLuong public List <Bangluong> GetCCTC_BANG_LUONG(string id) { List <Bangluong> listbangluong = new List <Bangluong>(); var vData = db.CCTC_BANG_LUONG.Where(x => x.USERNAME == id); foreach (var item in vData) { Bangluong bl = new Bangluong(); bl.THANG_LUONG = item.THANG_LUONG; bl.USERNAME = item.USERNAME; bl.LUONG_CO_BAN = string.Format("{0:#,##0.##}", item.LUONG_CO_BAN); bl.LUONG_BAO_HIEM = String.Format("{0:#,##0.##}", item.LUONG_BAO_HIEM); bl.PHU_CAP_AN_TRUA = String.Format("{0:#,##0.##}", item.PHU_CAP_AN_TRUA); bl.PHU_CAP_DI_LAI_DIEN_THOAI = String.Format("{0:#,##0.##}", item.PHU_CAP_DI_LAI_DIEN_THOAI); bl.PHU_CAP_THUONG_DOANH_SO = String.Format("{0:#,##0.##}", item.PHU_CAP_THUONG_DOANH_SO); bl.PHU_CAP_TRACH_NHIEM = String.Format("{0:#,##0.##}", item.PHU_CAP_TRACH_NHIEM); bl.CONG_CO_BAN = String.Format("{0:#,##0.##}", item.CONG_CO_BAN); bl.LUONG_CO_BAN_NGAY = String.Format("{0:#,##0.##}", item.CONG_CO_BAN); bl.LUONG_CO_BAN_GIO = String.Format("{0:#,##0.##}", item.LUONG_CO_BAN_GIO); bl.BAO_HIEM_CONG_TY_DONG = String.Format("{0:#,##0.##}", item.BAO_HIEM_CONG_TY_DONG); bl.BAO_HIEM_NHAN_VIEN_DONG = String.Format("{0:#,##0.##}", item.BAO_HIEM_NHAN_VIEN_DONG); bl.LUONG_THUC_TE_CONG_LAM_THUC = String.Format("{0:#,##0.##}", item.LUONG_THUC_TE_CONG_LAM_THUC); bl.LUONG_THUC_TE_SO_TIEN = String.Format("{0:#,##0.##}", item.LUONG_THUC_TE_SO_TIEN); bl.LUONG_LAM_THEM_CONG_NGAY_THUONG = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_CONG_NGAY_THUONG); bl.LUONG_LAM_THEM_TIEN_CONG_NGAY_THUONG = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_TIEN_CONG_NGAY_THUONG); bl.LUONG_LAM_THEM_CONG_NGAY_NGHI = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_CONG_NGAY_NGHI); bl.LUONG_LAM_THEM_TIEN_CONG_NGAY_NGHI = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_TIEN_CONG_NGAY_NGHI); bl.LUONG_LAM_THEM_CONG_NGAY_LE = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_CONG_NGAY_LE); bl.LUONG_LAM_THEM_TIEN_CONG_NGAY_LE = String.Format("{0:#,##0.##}", item.LUONG_LAM_THEM_TIEN_CONG_NGAY_LE); bl.TONG_THU_NHAP = String.Format("{0:#,##0.##}", item.TONG_THU_NHAP); bl.TAM_UNG = String.Format("{0:#,##0.##}", item.TAM_UNG); bl.VAY_TIN_DUNG = String.Format("{0:#,##0.##}", item.VAY_TIN_DUNG); bl.GIO_DI_TRE = String.Format("{0:N2}", item.GIO_DI_TRE); bl.PHAT_DI_TRE = String.Format("{0:#,##0.##}", item.PHAT_DI_TRE); bl.PHAT_QUEN_DONG_PHUC = String.Format("{0:#,##0.##}", item.PHAT_QUEN_DONG_PHUC); bl.PHU_CAP_THEM = String.Format("{0:#,##0.##}", item.PHU_CAP_THEM); bl.CONG_DOAN = String.Format("{0:#,##0.##}", item.CONG_DOAN); bl.LUONG_LAO_CONG = String.Format("{0:#,##0.##}", item.LUONG_LAO_CONG); bl.THUC_LINH = String.Format("{0:#,##0.##}", item.THUC_LINH); listbangluong.Add(bl); } var result = listbangluong.ToList(); return(result); }
public async Task <ActionResult <Bangluong> > addBangluong(Bangluong bl) { var bangluong = await context.Bangluong.FindAsync(bl.bacluong); if (bangluong != null) { return(Ok(new { Status = false, Message = "Ma bac luong da ton tai" })); } if (ModelState.IsValid) { try { context.Add(bl); await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(Ok(new { Status = false, Message = "Erro" })); } } return(CreatedAtAction("", new { Status = true, Message = "Success", Bangluong = bl })); }