public async Task <bool> Save(WebStationSetting data) { if (data.id == 0) { return(false); } if (data.phone.Length != 11) { return(false); } var webinfo = await _db.WebStationSettings.SingleOrDefaultAsync(s => s.id == data.id); if (webinfo == null) { return(false); } var phone = data.phone.Trim(); webinfo.phone = phone.Substring(0, 3) + "-" + phone.Substring(3, 4) + "-" + phone.Substring(7, 4); webinfo.imgurl = data.imgurl; webinfo.Subheading = data.Subheading; await _db.SaveChangesAsync(); return(true); }
public async Task <IActionResult> Save(WebStationSetting data) { bool result = await _bll.Save(data); return(Json(result)); }