public int XuLyCongViec(Xulycongviec xlcv) { try { db.Xulycongviec.Add(xlcv); db.SaveChanges(); return(1); } catch { throw; } }
public int GiaoViec([FromBody] Xulycongviec xlcv) { db.Xulycongviec.Add(xlcv); try { if (ModelState.IsValid) { db.SaveChanges(); } return(1); } catch (DbUpdateException) { throw; } }
public int Delete(string idcongviec, int idnv) { try { Xulycongviec cv = db.Xulycongviec.Find(idcongviec, idnv); if (cv != null) { db.Xulycongviec.Remove(cv); db.SaveChanges(); return(1); } else { return(0); } } catch { throw; } }