public Tuple <Boolean, String, Voting> AddVoting(Voting voting) { try{ db.Add(voting); db.SaveChanges(); return(Tuple.Create(true, "Data Inserted Successfully", voting)); } catch (Exception ex) { return(Tuple.Create(false, ex.Message, voting)); } }
public IActionResult Post([FromBody] Proposal value) { try { db.Add(value); db.SaveChanges(); return(Ok(value)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public Tuple <Boolean, String, PeriodManagement> AddPeriodManagement(PeriodManagement periodManagement) { try { db.Add(periodManagement); db.SaveChanges(); return(Tuple.Create(true, "Data Inserted Successfully", periodManagement)); } catch (Exception ex) { return(Tuple.Create(false, ex.Message, periodManagement)); } }
public IActionResult Post([FromBody] UserHeader value) { try { var q = db.UserHeader.Where(x => x.BinusianId == value.BinusianId).Count(); if (q > 0) { return(BadRequest("BinusianId already exists")); } db.Add(value); db.SaveChanges(); return(Ok(value)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }