public IActionResult Edit(Trademark_Request oTrademarkRequest) { Response oResponse = new Response(); try { using (texas_salesdbContext db = new texas_salesdbContext()) { Trademark oTrademark = db.Trademark.Find(oTrademarkRequest.TmId); oTrademark.TmName = oTrademarkRequest.TmName; db.Entry(oTrademark).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); oResponse.Success = true; } } catch (Exception ex) { oResponse.Message = ex.Message; } return(Ok(oResponse)); }
public IActionResult Add(Trademark_Request oTrademarkRequest) { Response oResponse = new Response(); try { using (texas_salesdbContext db = new texas_salesdbContext()) { Trademark oTrademark = new Trademark(); oTrademark.TmName = oTrademarkRequest.TmName; db.Add(oTrademark); db.SaveChanges(); oResponse.Success = true; } } catch (Exception ex) { oResponse.Message = ex.Message; } return(Ok(oResponse)); }