public async Task <ActionResult> Manage(PackageStateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                if (model.ImageFile != null)
                {
                    model = await this.UploadOnly("images/State", model);
                }

                var record = this.Mapper.Map <PackageStateModel>(model);
                if (model.Id == 0)
                {
                    record.SetAuditInfo(0);
                    await this.state.InsertAsync(record);

                    this.ShowMessage(Messages.SavedSuccessfully);
                }
                else
                {
                    record.UpdateAuditInfo(0);
                    await this.state.UpdateAsync(record);

                    this.ShowMessage(Messages.UpdateSuccessfully);
                }

                return(this.RedirectToRoute(Constants.RouteArea, new { controller = "state", action = "index", area = Constants.AreaAdmin }));
            }

            return(this.View(model));
        }
        public async Task <ActionResult> Manage(int id)
        {
            var model = new PackageStateViewModel();

            if (id > 0)
            {
                var record = await this.state.GetByIdAsync(id);

                if (record != null)
                {
                    model          = this.Mapper.Map <PackageStateViewModel>(record);
                    model.Coutries = (await this.masterService.GetPackageCountryListAsync(string.Empty, 1, record.CountryId)).ToSelectList();
                }
            }

            return(this.View(model));
        }
        private async Task <PackageStateViewModel> UploadOnly(string folder, PackageStateViewModel model)
        {
            model.Image = await this.UploadImageBlobStorage(folder, model.ImageFile);

            return(model);
        }