public static bool EditTime(TblTimes time) { try { using (var db = new DBContextModel()) { db.Entry(time).State = EntityState.Modified; db.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public static bool CreateTime(TblTimes time) { try { using (var db = new DBContextModel()) { db.TblTimes.Add(time); db.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
public Object Put([FromBody] TblTimes time) { Payload payload = BAccount.ConfirmToken(this.Request); if (payload == null || !payload.rol.Contains(6)) { return(new { result = false, info = "Não autorizado." }); } if (BTime.EditTime(time)) { return(new { result = true }); } return(new { result = false, info = "Não foi possível alterar a hora de aulas." }); }