public ActionResult DeleteConfirmed(int id) { var item = ExchangeRate.Find(id); try { using (var scope = new TransactionScope()) { item.DeleteAndFlush(); } return(PartialView("_DeleteSuccesful", item)); } catch (Exception) { return(PartialView("DeleteUnsuccessful")); } }
private void DoBatchSave() { IList <string> entStrList = RequestData.GetList <string>("data"); string sql = string.Empty; if (entStrList != null && entStrList.Count > 0) { for (int k = 0; k < entStrList.Count; k++) { Newtonsoft.Json.Linq.JObject objL = JsonHelper.GetObject <Newtonsoft.Json.Linq.JObject>(entStrList[k]); if (!string.IsNullOrEmpty(objL.Value <string>("Id"))) { ExchangeRate erEnt = ExchangeRate.Find(objL.Value <string>("Id")); erEnt.ModifyDate = System.DateTime.Now; erEnt.ModifyUserId = UserInfo.UserID; erEnt.ModifyName = UserInfo.Name; erEnt.MoneyType = objL.Value <string>("MoneyType"); erEnt.Rate = objL.Value <decimal>("Rate"); erEnt.Symbo = objL.Value <string>("Symbo"); erEnt.Remark = objL.Value <string>("Remark"); erEnt.DoUpdate(); } else { ExchangeRate erEnt = new ExchangeRate(); erEnt.MoneyType = objL.Value <string>("MoneyType");; erEnt.Rate = objL.Value <decimal>("Rate"); erEnt.Symbo = objL.Value <string>("Symbo"); erEnt.CreateId = UserInfo.UserID; erEnt.CreateName = UserInfo.Name; erEnt.ModifyDate = System.DateTime.Now; erEnt.ModifyUserId = UserInfo.UserID; erEnt.ModifyName = UserInfo.Name; erEnt.CreateTime = System.DateTime.Now; erEnt.Remark = objL.Value <string>("Remark"); erEnt.DoCreate(); } } } }
public ActionResult Delete(int id) { var item = ExchangeRate.Find(id); return(PartialView("_Delete", item)); }