コード例 #1
0
        public async Task <ActionResult> Edit(RemoteSiteModel site)
        {
            try
            {
                site.SiteDomains = site.SiteDomainsList.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList();

                if (site.Id == null)
                {
                    //creating
                    var res = await RemoteSiteUtil.AddSite(site);
                }
                else
                {
                    if (site.ResetApiKey)
                    {
                        site.ApiKey = Utils.GenApiKey();
                    }
                    // TODO: Add update logic here
                    var res = await RemoteSiteUtil.UpdateSite(site);
                }
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
コード例 #2
0
        public async Task <ActionResult> Delete(RemoteSiteModel site)
        {
            try
            {
                // TODO: Add delete logic here
                var res = await RemoteSiteUtil.DeleteSite(site.Id);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                Logging.WriteToAppLog("Error deleting remote site", System.Diagnostics.EventLogEntryType.Error, ex);
                ViewBag.Error = "An error occured trying to delete the record, please check the error logs and try again.";
                return(View("Edit", site));
            }
        }