Exemple #1
0
        public async Task <ActionResult> Savedata(List <Usage> lstUsage)
        {
            UsageHelper helper = new UsageHelper();

            try
            {
                bool res = await helper.SaveData(lstUsage);

                if (res)
                {
                    ViewBag.Messages = "Thanks for submitting data.Your data has been successfully saved.";
                    return(Json(new { redirectTo = Url.Action("Result", "Home") }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    ViewBag.Messages = "Not able to update the data now. Please try again after some time.";
                    return(Json(new { redirectTo = Url.Action("Result", "Home") }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                ViewBag.Messages = "Some error occurred. Please try again. " + ex.Message;
                return(Json(new { redirectTo = Url.Action("Result", "Home") }, JsonRequestBehavior.AllowGet));
            }
        }