Browse Source

修正BAS009/BAS010/BAS011

PTD
Shani 3 years ago
parent
commit
b798840f52
  1. 6
      AMESCoreStudio.Web/Controllers/BASController.cs
  2. 90
      AMESCoreStudio.WebApi/Controllers/BAS/ClassInfoesController.cs
  3. 65
      AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs
  4. 65
      AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs
  5. 61
      AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs
  6. 23
      AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs

6
AMESCoreStudio.Web/Controllers/BASController.cs

@ -1084,7 +1084,7 @@ namespace AMESCoreStudio.Web.Controllers
result = await _basApi.PutFlowRule(model.FlowRuleID, JsonConvert.SerializeObject(model)); result = await _basApi.PutFlowRule(model.FlowRuleID, JsonConvert.SerializeObject(model));
} }
if (!result.Success) if (result.Success)
{ {
var _msg = model.FlowRuleID == 0 ? "添加成功!" : "修改成功!"; var _msg = model.FlowRuleID == 0 ? "添加成功!" : "修改成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg }); return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -1226,7 +1226,7 @@ namespace AMESCoreStudio.Web.Controllers
result = await _basApi.PutRuleStation(model.RuleStationID, JsonConvert.SerializeObject(model)); result = await _basApi.PutRuleStation(model.RuleStationID, JsonConvert.SerializeObject(model));
} }
if (!result.Success) if (result.Success)
{ {
var _msg = model.RuleStationID == 0 ? "添加成功!" : "修改成功!"; var _msg = model.RuleStationID == 0 ? "添加成功!" : "修改成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg }); return RedirectToAction("Refresh", "Home", new { msg = _msg });
@ -1378,7 +1378,7 @@ namespace AMESCoreStudio.Web.Controllers
result = await _basApi.PutRules(model.RuleStationID, JsonConvert.SerializeObject(model)); result = await _basApi.PutRules(model.RuleStationID, JsonConvert.SerializeObject(model));
} }
if (!result.Success) if (result.Success)
{ {
var _msg = model.CreateDate == System.DateTime.MinValue ? "添加成功!" : "修改成功!"; var _msg = model.CreateDate == System.DateTime.MinValue ? "添加成功!" : "修改成功!";
return RedirectToAction("Refresh", "Home", new { msg = _msg }); return RedirectToAction("Refresh", "Home", new { msg = _msg });

90
AMESCoreStudio.WebApi/Controllers/BAS/ClassInfoesController.cs

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi;
using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.WebApi.Models.BAS;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.BAS namespace AMESCoreStudio.WebApi.Controllers.BAS
{ {
@ -64,11 +65,6 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
IQueryable<ClassInfo> q = _context.ClassInfoes; IQueryable<ClassInfo> q = _context.ClassInfoes;
q = q.Where(p => p.ClassID.Equals(id)); q = q.Where(p => p.ClassID.Equals(id));
var classInfo = await q.ToListAsync(); var classInfo = await q.ToListAsync();
//foreach (var data in classInfo)
//{
// //data.Unit = _context.FactoryUnits.Find(data.UnitNo);
//}
if (classInfo == null) if (classInfo == null)
{ {
@ -122,34 +118,33 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPut("{id}")] [HttpPut("{id}")]
public async Task<ActionResult<ClassInfo>> PutClassInfo(int id, [FromBody] ClassInfo classInfo) public async Task<ResultModel<ClassInfo>> PutClassInfo(int id, [FromBody] ClassInfo classInfo)
{
if (id != classInfo.ClassID)
{ {
return BadRequest(); ResultModel<ClassInfo> result = new ResultModel<ClassInfo>();
}
classInfo.UpdateDate = System.DateTime.Now; classInfo.UpdateDate = System.DateTime.Now;
classInfo.StatusNo = "A"; classInfo.StatusNo = "A";
if (id != classInfo.ClassID)
{
result.Success = false;
result.Msg = "序號錯誤";
return result;
}
_context.Entry(classInfo).State = EntityState.Modified; _context.Entry(classInfo).State = EntityState.Modified;
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{ {
if (!ClassInfoExists(id)) result.Success = false;
{ result.Msg = ex.InnerException.Message;
return NotFound();
}
else
{
throw;
}
} }
return result;
return classInfo;
} }
/// <summary> /// <summary>
@ -161,18 +156,30 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPost] [HttpPost]
public async Task<ActionResult<ClassInfo>> PostClassInfo(ClassInfo classInfo) public async Task<ResultModel<ClassInfo>> PostClassInfo(ClassInfo classInfo)
{ {
ResultModel<ClassInfo> result = new ResultModel<ClassInfo>();
Helper helper = new Helper(_context); Helper helper = new Helper(_context);
classInfo.ClassID = helper.GetIDKey("CLASS_ID").Result; classInfo.ClassID = helper.GetIDKey("CLASS_ID").Result;
classInfo.StatusNo = "A"; classInfo.StatusNo = "A";
if (string.IsNullOrEmpty(classInfo.ClassDesc)) if (string.IsNullOrEmpty(classInfo.ClassDesc))
classInfo.ClassDesc = " "; classInfo.ClassDesc = " ";
_context.ClassInfoes.Add(classInfo); _context.ClassInfoes.Add(classInfo);
await _context.SaveChangesAsync();
return CreatedAtAction("GetClassInfo", new { id = classInfo.ClassID }, classInfo); try
{
await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
} }
@ -183,48 +190,41 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
/// <returns></returns> /// <returns></returns>
// DELETE: api/ClassInfoes/5 // DELETE: api/ClassInfoes/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<ClassInfo>> DeleteClassInfo(int id) public async Task<ResultModel<ClassInfo>> DeleteClassInfo(int id)
{ {
//var classInfo = await _context.ClassInfo.FindAsync(id); ResultModel<ClassInfo> result = new ResultModel<ClassInfo>();
var classInfo = await _context.ClassInfoes.Where(m => m.ClassID == id).FirstOrDefaultAsync(); var classInfo = await _context.ClassInfoes.Where(m => m.ClassID == id).FirstOrDefaultAsync();
if (classInfo == null) if (classInfo == null)
{ {
return NotFound(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
//////
var classInfoNew = new ClassInfo(); var classInfoNew = new ClassInfo();
classInfoNew = classInfo; classInfoNew = classInfo;
_context.Entry(classInfoNew).State = EntityState.Modified; _context.Entry(classInfoNew).State = EntityState.Modified;
if (classInfo.StatusNo == "A")
classInfoNew.StatusNo = "S"; classInfoNew.StatusNo = "S";
else
classInfoNew.StatusNo = "A";
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{
if (!ClassInfoExists(id))
{ {
return NotFound(); result.Success = false;
} result.Msg = ex.InnerException.Message;
else
{
throw;
}
} }
return classInfoNew; return result;
/////
//_context.ClassInfoes.Remove(classInfo);
//await _context.SaveChangesAsync();
//return classInfo;
} }
private bool ClassInfoExists(int id) private bool ClassInfoExists(int id)

65
AMESCoreStudio.WebApi/Controllers/BAS/FlowRulesController.cs

@ -5,6 +5,7 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.WebApi.Models.BAS;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.BAS namespace AMESCoreStudio.WebApi.Controllers.BAS
{ {
@ -112,33 +113,33 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPut("{id}")] [HttpPut("{id}")]
public async Task<ActionResult<FlowRule>> PutFlowRule(int id, [FromBody] FlowRule flowRule) public async Task<ResultModel<FlowRule>> PutFlowRule(int id, [FromBody] FlowRule flowRule)
{ {
ResultModel<FlowRule> result = new ResultModel<FlowRule>();
_context.Entry(flowRule).State = EntityState.Modified;
flowRule.UpdateDate = DateTime.Now;
if (id != flowRule.FlowRuleID) if (id != flowRule.FlowRuleID)
{ {
return BadRequest(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.Entry(flowRule).State = EntityState.Modified; _context.Entry(flowRule).State = EntityState.Modified;
flowRule.UpdateDate = DateTime.Now;
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{
if (!FlowRuleExists(id))
{ {
return NotFound(); result.Success = false;
} result.Msg = ex.InnerException.Message;
else
{
throw;
}
} }
return result;
return flowRule;
} }
/// <summary> /// <summary>
@ -150,16 +151,28 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPost] [HttpPost]
public async Task<ActionResult<FlowRule>> PostFlowRule([FromBody] FlowRule flowRule) public async Task<ResultModel<FlowRule>> PostFlowRule([FromBody] FlowRule flowRule)
{ {
ResultModel<FlowRule> result = new ResultModel<FlowRule>();
Helper helper = new Helper(_context); Helper helper = new Helper(_context);
flowRule.FlowRuleID = helper.GetIDKey("FLOW_RULE_ID").Result; flowRule.FlowRuleID = helper.GetIDKey("FLOW_RULE_ID").Result;
flowRule.CreateDate = DateTime.Now; flowRule.CreateDate = DateTime.Now;
_context.FlowRules.Add(flowRule); _context.FlowRules.Add(flowRule);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
return CreatedAtAction("GetFlowRule", new { id = flowRule.FlowRuleID }, flowRule);
} }
/// <summary> /// <summary>
@ -169,18 +182,32 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
/// <returns></returns> /// <returns></returns>
// DELETE: api/FlowRules/5 // DELETE: api/FlowRules/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<FlowRule>> DeleteFlowRule(int id) public async Task<ResultModel<FlowRule>> DeleteFlowRule(int id)
{ {
ResultModel<FlowRule> result = new ResultModel<FlowRule>();
var flowRule = await _context.FlowRules.FindAsync(id); var flowRule = await _context.FlowRules.FindAsync(id);
if (flowRule == null) if (flowRule == null)
{ {
return NotFound(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.FlowRules.Remove(flowRule); _context.FlowRules.Remove(flowRule);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return flowRule; return result;
} }
private bool FlowRuleExists(int id) private bool FlowRuleExists(int id)

65
AMESCoreStudio.WebApi/Controllers/BAS/RuleStationsController.cs

@ -9,6 +9,7 @@ using AMESCoreStudio.WebApi;
using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.WebApi.Models.BAS;
using AMESCoreStudio.WebApi.DTO.AMES; using AMESCoreStudio.WebApi.DTO.AMES;
using AMESCoreStudio.WebApi.Controllers.AMES; using AMESCoreStudio.WebApi.Controllers.AMES;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.BAS namespace AMESCoreStudio.WebApi.Controllers.BAS
{ {
@ -203,11 +204,15 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPut("{id}")] [HttpPut("{id}")]
public async Task<ActionResult<RuleStation>> PutRuleStation(int id, [FromBody] RuleStation ruleStation) public async Task<ResultModel<RuleStation>> PutRuleStation(int id, [FromBody] RuleStation ruleStation)
{ {
ResultModel<RuleStation> result = new ResultModel<RuleStation>();
if (id != ruleStation.RuleStationID) if (id != ruleStation.RuleStationID)
{ {
return BadRequest(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.Entry(ruleStation).State = EntityState.Modified; _context.Entry(ruleStation).State = EntityState.Modified;
@ -216,20 +221,17 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{
if (!RuleStationExists(id))
{ {
return NotFound(); result.Success = false;
} result.Msg = ex.InnerException.Message;
else
{
throw;
}
} }
return ruleStation; return result;
} }
/// <summary> /// <summary>
@ -241,16 +243,28 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPost] [HttpPost]
public async Task<ActionResult<RuleStation>> PostRuleStation([FromBody] RuleStation ruleStation) public async Task<ResultModel<RuleStation>> PostRuleStation([FromBody] RuleStation ruleStation)
{ {
ResultModel<RuleStation> result = new ResultModel<RuleStation>();
Helper helper = new Helper(_context); Helper helper = new Helper(_context);
ruleStation.RuleStationID = helper.GetIDKey("RULE_STATION_ID").Result; ruleStation.RuleStationID = helper.GetIDKey("RULE_STATION_ID").Result;
ruleStation.CreateDate = DateTime.Now; ruleStation.CreateDate = DateTime.Now;
_context.RuleStations.Add(ruleStation); _context.RuleStations.Add(ruleStation);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
return CreatedAtAction("GetRuleStation", new { id = ruleStation.RuleStationID }, ruleStation);
} }
/// <summary> /// <summary>
@ -260,18 +274,35 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
/// <returns></returns> /// <returns></returns>
// DELETE: api/RuleStations/5 // DELETE: api/RuleStations/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<RuleStation>> DeleteRuleStation(int id) public async Task<ResultModel<RuleStation>> DeleteRuleStation(int id)
{ {
ResultModel<RuleStation> result = new ResultModel<RuleStation>();
var ruleStation = await _context.RuleStations.FindAsync(id); var ruleStation = await _context.RuleStations.FindAsync(id);
if (ruleStation == null) if (ruleStation == null)
{ {
return NotFound(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.RuleStations.Remove(ruleStation); _context.RuleStations.Remove(ruleStation);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return result;
return ruleStation;
} }
private bool RuleStationExists(int id) private bool RuleStationExists(int id)

61
AMESCoreStudio.WebApi/Controllers/BAS/RulesController.cs

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using AMESCoreStudio.WebApi; using AMESCoreStudio.WebApi;
using AMESCoreStudio.WebApi.Models.BAS; using AMESCoreStudio.WebApi.Models.BAS;
using AMESCoreStudio.CommonTools.Result;
namespace AMESCoreStudio.WebApi.Controllers.BAS namespace AMESCoreStudio.WebApi.Controllers.BAS
{ {
@ -172,11 +173,14 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPut("{id}")] [HttpPut("{id}")]
public async Task<ActionResult<Rules>> PutRules(int id, [FromBody]Rules rules) public async Task<ResultModel<Rules>> PutRules(int id, [FromBody]Rules rules)
{ {
ResultModel<Rules> result = new ResultModel<Rules>();
if (id != rules.RuleStationID) if (id != rules.RuleStationID)
{ {
return BadRequest(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.Entry(rules).State = EntityState.Modified; _context.Entry(rules).State = EntityState.Modified;
@ -185,20 +189,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{ {
if (!RulesExists(id)) result.Success = false;
{ result.Msg = ex.InnerException.Message;
return NotFound();
}
else
{
throw;
}
} }
return rules; return result;
} }
/// <summary> /// <summary>
@ -210,14 +210,28 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
// To protect from overposting attacks, enable the specific properties you want to bind to, for // To protect from overposting attacks, enable the specific properties you want to bind to, for
// more details, see https://go.microsoft.com/fwlink/?linkid=2123754. // more details, see https://go.microsoft.com/fwlink/?linkid=2123754.
[HttpPost] [HttpPost]
public async Task<ActionResult<Rules>> PostRules([FromBody] Rules rules) public async Task<ResultModel<Rules>> PostRules([FromBody] Rules rules)
{ {
ResultModel<Rules> result = new ResultModel<Rules>();
rules.CreateDate = DateTime.Now; rules.CreateDate = DateTime.Now;
_context.Ruleses.Add(rules); _context.Ruleses.Add(rules);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return CreatedAtAction("GetRules", new { id = rules.RuleStationID }, rules); return result;
} }
/// <summary> /// <summary>
@ -227,18 +241,31 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
/// <returns></returns> /// <returns></returns>
// DELETE: api/Rules/5 // DELETE: api/Rules/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<Rules>> DeleteRules(int id) public async Task<ResultModel<Rules>> DeleteRules(int id)
{ {
ResultModel<Rules> result = new ResultModel<Rules>();
var rules = await _context.Ruleses.FindAsync(id); var rules = await _context.Ruleses.FindAsync(id);
if (rules == null) if (rules == null)
{ {
return NotFound(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
_context.Ruleses.Remove(rules); _context.Ruleses.Remove(rules);
try
{
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
}
catch (Exception ex)
{
result.Success = false;
result.Msg = ex.InnerException.Message;
}
return rules; return result;
} }
private bool RulesExists(int id) private bool RulesExists(int id)

23
AMESCoreStudio.WebApi/Controllers/BAS/StationsesController.cs

@ -183,13 +183,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
/// <returns></returns> /// <returns></returns>
// DELETE: api/Stationses/5 // DELETE: api/Stationses/5
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<ActionResult<Stations>> DeleteStations(int id) public async Task<ResultModel<Stations>> DeleteStations(int id)
{ {
//var stations = await _context.Stations.FindAsync(id); //var stations = await _context.Stations.FindAsync(id);
ResultModel<Stations> result = new ResultModel<Stations>();
var stations = await _context.Stationses.Where(m => m.StationID == id).FirstOrDefaultAsync(); var stations = await _context.Stationses.Where(m => m.StationID == id).FirstOrDefaultAsync();
if (stations == null) if (stations == null)
{ {
return NotFound(); result.Success = false;
result.Msg = "序號錯誤";
return result;
} }
////// //////
@ -204,20 +207,16 @@ namespace AMESCoreStudio.WebApi.Controllers.BAS
try try
{ {
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
} }
catch (DbUpdateConcurrencyException) catch (Exception ex)
{
if (!StationsExists(id))
{
return NotFound();
}
else
{ {
throw; result.Success = false;
} result.Msg = ex.InnerException.Message;
} }
return stationsNew; return result;

Loading…
Cancel
Save