/// <summary>
        /// Indexes the specified model.
        /// </summary>
        /// <param name="id">Visa Id</param>
        /// <param name="mode">Curation Mode</param>
        /// <returns>View</returns>
        public async Task <IActionResult> Manage(int?id, string mode)
        {
            this.ViewBag.Mode = mode;
            CurationsAddViewModel model = new CurationsAddViewModel();

            if (mode == "1x1")
            {
                model.OneXOne = true;
                model.OneXTwo = false;
                model.TwoXTwo = false;
            }

            if (mode == "1x2")
            {
                model.OneXOne = false;
                model.OneXTwo = true;
                model.TwoXTwo = false;
            }

            if (mode == "2x2")
            {
                model.OneXOne = false;
                model.OneXTwo = false;
                model.TwoXTwo = true;
            }

            if (id > 0)
            {
                model = this.Mapper.Map <CurationsAddViewModel>(await this.curationService.GetCurationByIdAsync(Convert.ToInt32(id)));
            }
            else
            {
                model.Id       = 0;
                model.IsActive = true;
            }

            model.Mode = mode;
            return(this.View(model));
        }
        public async Task <IActionResult> Manage(CurationsAddViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                var data = this.Mapper.Map <CurationsModel>(model);
                if (model.Id == 0)
                {
                    if (model.ImageFile != null)
                    {
                        model = await this.UploadOnly("CurationImages", model);
                    }

                    var record = this.Mapper.Map <CurationsModel>(model);
                    record.SetAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value));
                    await this.curationService.InsertAsync(record);

                    this.ShowMessage(Messages.SavedSuccessfully);
                }
                else
                {
                    if (model.ImageFile != null)
                    {
                        model = await this.UploadOnly("CurationImages", model);

                        data.Image = model.Image;
                    }

                    data.UpdateAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value));
                    await this.curationService.UpdateAsync(data);

                    this.ShowMessage(Messages.UpdateSuccessfully);
                }

                return(this.RedirectToAction("index", "curation", new { @mode = model.Mode }));
            }

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

            return(model);
        }