public Producer AddProducer(Producer producer) { string connectionString = Utility.Util.GetConnectionString(MoviesStore.Service.Common.Util.MasterDataManager.ConfigData["MoviesStoreDb"]); string providerName = Utility.Util.GetProviderName(MoviesStore.Service.Common.Util.MasterDataManager.ConfigData["MoviesStoreDb"]); string spName = MoviesStore.Service.Common.Util.MasterDataManager.ConfigData["AddProducer"]; try { return(_producerRepository.AddProducer(producer, spName, providerName, connectionString)); } catch (Exception e) { throw e.InnerException; } }
public ActionResult Create([Bind(Include = "Producer_Id,Producer_Name,Producer_Photo,Producer_Sex,Producer_DOB,Producer_Bio,Producer_Photo_Data")] ProducerModel ProducerModel) { try { if (ModelState.IsValid) { if (ProducerModel.Producer_Photo_Data == null) { ViewBag.FileStatus = "Please select image."; return(View(ProducerModel)); } else { ProducerModel.Producer_Photo = ProducerModel.Producer_Photo_Data.FileName; String path = Server.MapPath("Image"); String filename = Path.GetFileName(ProducerModel.Producer_Photo_Data.FileName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } else { String fullpath = Path.Combine(path, filename); ProducerModel.Producer_Photo_Data.SaveAs(fullpath); } } _ProducerRep.AddProducer(ProducerModel); _ProducerRep.save(); return(RedirectToAction("Index")); } } catch (DataException e) { ViewBag.FileStatus = e; ModelState.AddModelError("", "Unable to save changes."); } return(View(ProducerModel)); }
public void Add(Producer producer) { _producerRepository.AddProducer(producer); }