public ActionResult UploadApplication(Application application)
        {
            try
            {
                if (!IsApplicationValid(application))
                {
                    return(View(application));
                }

                // Check application exists in Application Grid
                ApApplicationExistsRequest  request  = new ApApplicationExistsRequest(Credentials);
                ApApplicationExistsResponse response = EndPoints.ApDashboardService.ApplicationExists(request);

                if (response.Exists)
                {
                    ModelState.AddModelError("Application", "Application version already exists.");
                    return(View(application));
                }
                else
                {
                    HttpPostedFileBase file = Request.Files["applicationPackage"];
                    application.FileName = file.FileName;
                    UploadFile(file.InputStream, application);
                    return(RedirectToAction("Applications"));
                }
            }
            catch (Exception e)
            {
                return(ShowError(e));
            }
        }
Esempio n. 2
0
        public ApApplicationExistsResponse ApplicationExists(ApApplicationExistsRequest request)
        {
            Log.Info(this, "ApplicationExists()");

            try
            {
                Authenticate(request);
                ApApplicationExistsResponse response = new ApApplicationExistsResponse();
                if (Database.GetInstance().Applications != null)
                {
                    Application app = Database.GetInstance().Applications.Where(x => x.Id == request.ApplicationId).FirstOrDefault();
                    response.Exists = (app != null);
                }
                return(response);
            }
            catch (Exception e)
            {
                Log.Error(this, e);
                throw e;
            }
        }