Beispiel #1
0
        public ActionResult Edit(string id, string value)
        {
            var iid = id.Substring(1).ToInt();
            var c   = CurrentDatabase.Contributions.SingleOrDefault(co => co.ContributionId == iid);

            if (c != null)
            {
                var m = new PostBundleModel(CurrentDatabase);
                switch (id.Substring(0, 1))
                {
                case "a":
                    c.ContributionAmount = value.ToDecimal();
                    CurrentDatabase.SubmitChanges();
                    return(Json(m.ContributionRowData(this, iid)));

                case "f":
                    c.FundId = value.ToInt();
                    CurrentDatabase.SubmitChanges();
                    return(Content($"{c.ContributionFund.FundId} - {c.ContributionFund.FundName}"));

                case "k":
                    c.CheckNo = value;
                    CurrentDatabase.SubmitChanges();
                    return(Json(m.ContributionRowData(this, iid)));
                }
            }
            return(new EmptyResult());
        }
        public ActionResult Edit(string id, string value)
        {
            var iid = id.Substring(1).ToInt();
            var c   = DbUtil.Db.Contributions.SingleOrDefault(co => co.ContributionId == iid);

            if (c != null)
            {
                switch (id.Substring(0, 1))
                {
                case "a":
                    c.ContributionAmount = value.ToDecimal();
                    DbUtil.Db.SubmitChanges();
                    var m = new PostBundleModel();
                    return(Json(m.ContributionRowData(this, iid)));

                case "f":
                    c.FundId = value.ToInt();
                    DbUtil.Db.SubmitChanges();
                    return(Content("{0} - {1}".Fmt(c.ContributionFund.FundId, c.ContributionFund.FundName)));
                }
            }
            return(new EmptyResult());
        }