public ActionResult Create(FileRepositoryCreateViewModel model) { model.Years = _dropDownService.GetYears(2011, 2030).MapTo <SelectListItem>(); model.Months = _dropDownService.GetMonths().MapTo <SelectListItem>(); if (ModelState.IsValid) { SaveFileRepositoryRequest saveModel = new SaveFileRepositoryRequest(); saveModel = model.MapTo <SaveFileRepositoryRequest>(); //this should be the reader //try to read data on buffer saveModel.Data = (byte[])Session[model.Filename]; saveModel.LastWriteTime = DateTime.Now; saveModel.UserId = this.UserProfile().UserId; if (_fileRepositoryService.Save(saveModel).IsSuccess) { return(RedirectToAction("Index", "MIR")); } else { return(View(model)); } } else { return(View(model)); } }
public ActionResult Create() { FileRepositoryCreateViewModel model = new FileRepositoryCreateViewModel { ExSumDefaultPage = 3, Year = DateTime.Now.Year, Month = DateTime.Now.Month - 1, Years = _dropDownService.GetYears(2011, 2030).MapTo <SelectListItem>(), Months = _dropDownService.GetMonths().MapTo <SelectListItem>() }; return(View(model)); }