public static LocalisationModel CreateLocaleFromFile(string fileName) { LocalisationModel container = new LocalisationModel( Path.GetFileNameWithoutExtension(fileName)); IEnumerable <string> lines = File.ReadLines(fileName); bool firstline = true; foreach (string line in lines) { if (string.IsNullOrWhiteSpace(line)) { continue; } if (firstline) { container.LanguageName = line.Replace(":", "").Trim(); firstline = false; } else { LocaleModel content = new LocaleModel() { Key = line.Split(':')[0].Trim(), Value = Regex.Match(line.Split(':')[1], "\"([^\"]*)\"").Groups[1].Value.Trim() }; container.LocalisationMap.Add(content); } } return(container); }
private void CopyElement(object obj) { UndoService.Current[GetUndoRoot()].BeginChangeSetBatch("CopyAnyFile", false); FileManager dialog = new FileManager(ModeType.Edit); if (obj is FocusGridModel) { FocusGridModel item = new FocusGridModel((FocusGridModel)obj); item.VisibleName += "_copy"; Project.fociList.Add(item); RaisePropertyChanged(() => Project.fociList); } else if (obj is LocalisationModel) { LocalisationModel item = new LocalisationModel((LocalisationModel)obj); item.VisibleName += "_copy"; Project.localisationList.Add(item); RaisePropertyChanged(() => Project.localisationList); } else if (obj is EventTabModel) { EventTabModel item = new EventTabModel((EventTabModel)obj); item.VisibleName += "_copy"; Project.eventList.Add(item); RaisePropertyChanged(() => Project.eventList); } else if (obj is ScriptModel) { ScriptModel item = new ScriptModel((ScriptModel)obj); item.VisibleName += "_copy"; Project.scriptList.Add(item); RaisePropertyChanged(() => Project.scriptList); } UndoService.Current[GetUndoRoot()].EndChangeSetBatch(); }
private void NotificationMessageReceived(NotificationMessage msg) { if (msg.Target != null && msg.Target != this) { //Message not itended for here return; } if (msg.Notification == "OpenFocusTree") { FociGridContainer container = msg.Sender as FociGridContainer; if (TabsModelList.Where((t) => t is FocusGridModel && ((FocusGridModel)t).UniqueID == container.IdentifierID).Any()) { return; } FocusGridModel newModel = new FocusGridModel(container.IdentifierID); TabsModelList.Add(newModel); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenLocalisation") { LocalisationContainer container = msg.Sender as LocalisationContainer; if (TabsModelList.Where((t) => t is LocalisationModel && ((LocalisationModel)t).UniqueID == container.IdentifierID).Any()) { return; } LocalisationModel newModel = new LocalisationModel(container.IdentifierID); TabsModelList.Add(newModel); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SaveProject") { saveProject(); } if (msg.Notification == "RefreshProjectViewer") { TabsModelList.Clear(); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SendDeleteItemSignal") { ObservableObject Model = null; if (msg.Sender is FociGridContainer) { Model = TabsModelList.FirstOrDefault((m) => m is FocusGridModel && ((FocusGridModel)m).UniqueID == ((FociGridContainer)msg.Sender).IdentifierID); } else if (msg.Sender is LocalisationContainer) { Model = TabsModelList.FirstOrDefault((m) => m is LocalisationModel && ((LocalisationModel)m).UniqueID == ((LocalisationContainer)msg.Sender).IdentifierID); } TabsModelList.Remove(Model); RaisePropertyChanged("TabsModelList"); } }
private LocalisationModel TestScriptToLocale() { //Act LocalisationModel model = LocalisationParser.CreateLocaleFromFile("focus_l_english.yml"); //Assert Assert.IsNotNull(model); Assert.IsTrue(model.LocalisationMap.Any()); Assert.AreEqual(model.LanguageName, "l_english"); Assert.AreEqual(model.VisibleName, "focus_l_english"); return(model); }
public LocalisationContainer(LocalisationModel item) { IdentifierID = item.UniqueID; ContainerID = item.VisibleName; LanguageName = item.LanguageName; FileInfo = item.FileInfo; LocalisationMap = new List <LocaleContent>(); foreach (LocaleModel model in item.LocalisationMap) { LocalisationMap.Add(new LocaleContent() { Key = model.Key, Value = model.Value }); } }
private void TestLocaleToScript(LocalisationModel model) { //Arrange LocalisationContainer container = new LocalisationContainer(model); List <LocalisationContainer> list = new List <LocalisationContainer> { container }; //Act Dictionary <string, string> files = LocalisationParser.ParseEverything(list); string filecontent = files.FirstOrDefault().Value; string fileName = files.FirstOrDefault().Key; //Assert Assert.IsNotNull(filecontent); Assert.IsNotNull(fileName); Assert.AreEqual(fileName, "focus_l_english"); }
public void SetFileType(object param) { File = null; ListViewItem item = param as ListViewItem; if (item == null) { return; } switch (item.Tag as string) { case "FocusTreeItem": File = new FocusGridModel("New file"); Messenger.Default.Send(new NotificationMessage(this, new ViewModelLocator().Tutorial, "NewFocusTreeFile")); break; case "LocalisationItem": File = new LocalisationModel("New file"); Messenger.Default.Send(new NotificationMessage(this, new ViewModelLocator().Tutorial, "NewLocalizationFile")); break; case "EventItem": File = new EventTabModel("New file"); Messenger.Default.Send(new NotificationMessage(this, new ViewModelLocator().Tutorial, "NewEventFile")); break; case "GenericItem": File = new ScriptModel("New file"); Messenger.Default.Send(new NotificationMessage(this, new ViewModelLocator().Tutorial, "NewScriptFile")); break; } }
private void EditElement(object obj) { UndoService.Current[GetUndoRoot()].BeginChangeSetBatch("EditAnyFile", false); FileManager dialog = new FileManager(ModeType.Edit); if (obj is FocusGridModel) { FocusGridModel item = (FocusGridModel)obj; new ViewModelLocator().FileManager.File = new FocusGridModel(item.VisibleName) { TAG = item.TAG, AdditionnalMods = item.AdditionnalMods }; dialog.ShowDialog(); if (new ViewModelLocator().FileManager.File == null) { return; } FocusGridModel newItem = new ViewModelLocator().FileManager.File as FocusGridModel; if (newItem == null) { return; } item.VisibleName = newItem.VisibleName; item.TAG = newItem.TAG; item.AdditionnalMods = newItem.AdditionnalMods; } else if (obj is LocalisationModel) { LocalisationModel item = (LocalisationModel)obj; new ViewModelLocator().FileManager.File = new LocalisationModel(item.VisibleName) { LanguageName = item.LanguageName }; dialog.ShowDialog(); if (new ViewModelLocator().FileManager.File == null) { return; } LocalisationModel newItem = new ViewModelLocator().FileManager.File as LocalisationModel; if (newItem == null) { return; } item.VisibleName = newItem.VisibleName; item.LanguageName = newItem.LanguageName; } else if (obj is EventTabModel) { EventTabModel item = (EventTabModel)obj; new ViewModelLocator().FileManager.File = new EventTabModel(item.VisibleName) { EventNamespace = item.EventNamespace }; dialog.ShowDialog(); if (new ViewModelLocator().FileManager.File == null) { return; } EventTabModel newItem = (new ViewModelLocator()).FileManager.File as EventTabModel; if (newItem == null) { return; } item.VisibleName = newItem.VisibleName; item.EventNamespace = newItem.EventNamespace; } else if (obj is ScriptModel) { ScriptModel item = (ScriptModel)obj; new ViewModelLocator().FileManager.File = new ScriptModel(item.VisibleName); dialog.ShowDialog(); if (new ViewModelLocator().FileManager.File == null) { return; } ScriptModel newItem = new ViewModelLocator().FileManager.File as ScriptModel; if (newItem != null) { item.VisibleName = newItem.VisibleName; } } UndoService.Current[GetUndoRoot()].EndChangeSetBatch(); }
private void NotificationMessageReceived(NotificationMessage msg) { //If this is not the intended target if (msg.Target != null && msg.Target != this) { return; } if (msg.Notification == "OpenFocusTree") { FocusGridModel container = msg.Sender as FocusGridModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenLocalisation") { LocalisationModel container = msg.Sender as LocalisationModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenEventList") { EventTabModel container = msg.Sender as EventTabModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "OpenScriptList") { ScriptModel container = msg.Sender as ScriptModel; if (TabsModelList.Contains(container)) { return; } CheckForChanges(container); TabsModelList.Add(container); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SaveProject") { saveProject(); } if (msg.Notification == "RefreshProjectViewer") { TabsModelList.Clear(); RaisePropertyChanged("TabsModelList"); } if (msg.Notification == "SendDeleteItemSignal") { ObservableObject Model = null; if (msg.Sender is FocusGridModel) { Model = TabsModelList.FirstOrDefault((m) => m is FocusGridModel && ((FocusGridModel)m).UniqueID == ((FocusGridModel)msg.Sender).UniqueID); } else if (msg.Sender is LocalisationModel) { Model = TabsModelList.FirstOrDefault((m) => m is LocalisationModel && ((LocalisationModel)m).UniqueID == ((LocalisationModel)msg.Sender).UniqueID); } else if (msg.Sender is EventTabModel) { Model = TabsModelList.FirstOrDefault((m) => m is EventTabModel && ((EventTabModel)m).UniqueID == ((EventTabModel)msg.Sender).UniqueID); } else if (msg.Sender is ScriptModel) { Model = TabsModelList.FirstOrDefault((m) => m is ScriptModel && ((ScriptModel)m).UniqueID == ((ScriptModel)msg.Sender).UniqueID); } TabsModelList.Remove(Model); RaisePropertyChanged("TabsModelList"); } if (msg.Target == this) { //Resend to the tutorial View model if this was the target Messenger.Default.Send(new NotificationMessage(msg.Sender, new ViewModelLocator().Tutorial, msg.Notification)); } }
public virtual ActionResult RefuseQuotation(int id, LocalisationModel<RefuseQuotationModel> formModel, string confirm) { if (string.IsNullOrEmpty(confirm)) { return Redirect(formModel.InnerModel.ReturnUrl); } var context = ModelFactory.GetUnitOfWork(); var qRepo = ModelFactory.GetRepository<IQuotationRepository>(context); var memberId = WebHelper.GetIdentityId(User.Identity); if (ModelState.IsValid) { try { var quotation = qRepo.Get(id); quotation.StatusId = (int)MemberQuotation.Status.Refused; quotation.MemberQuotationLogs.Add(new MemberQuotationLog { CreatedDate = DateTime.UtcNow, Event = "Quotation Refused", EventType = (int)MemberQuotationLog.QuotationEvent.Refusal, LoggerId = memberId }); context.Commit(); TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.Booking.BookingString.QuotationRefused; return RedirectToAction(MVC.Backoffice.Localisation.QuotationDetail(quotation.Id)); } catch (Exception ex) { _Logger.Error("RefuseBooking", ex); context.Complete(); } } return View(formModel); }
public virtual ActionResult RefuseBooking(int id, LocalisationModel<RefuseBookingModel> formModel, string confirm) { if (string.IsNullOrEmpty(confirm)) { return Redirect(formModel.InnerModel.ReturnUrl); } var context = ModelFactory.GetUnitOfWork(); var bRepo = ModelFactory.GetRepository<IBookingRepository>(context); var memberId = WebHelper.GetIdentityId(User.Identity); if (ModelState.IsValid) { try { var booking = bRepo.Get(id); UpdateModel(booking, "InnerModel"); booking.StatusId = (int)MemberBooking.Status.Refused; booking.MemberBookingLogs.Add(new MemberBookingLog { CreatedDate = DateTime.UtcNow, Event = "Booking Refused", EventType = (int)MemberBookingLog.BookingEvent.Refusal, LoggerId = memberId }); var clientMailContent = string.Format(Worki.Resources.Email.BookingString.RefuseBookingClient, Localisation.GetOfferType(booking.Offer.Type), booking.GetStartDate(), booking.GetEndDate(), booking.Offer.Localisation.Name, booking.Offer.Localisation.Adress + ", " + booking.Offer.Localisation.PostalCode + " " + booking.Offer.Localisation.City); var clientMail = _EmailService.PrepareMessageFromDefault(new MailAddress(booking.Client.Email, booking.Client.MemberMainData.FirstName), Worki.Resources.Email.BookingString.RefuseBookingClientSubject, WebHelper.RenderEmailToString(booking.Client.MemberMainData.FirstName, clientMailContent)); context.Commit(); _EmailService.Deliver(clientMail); TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.Booking.BookingString.BookingRefused; return RedirectToAction(MVC.Backoffice.Localisation.BookingDetail(booking.Id)); } catch (Exception ex) { _Logger.Error("RefuseBooking", ex); context.Complete(); } } return View(formModel); }
public virtual ActionResult ConfirmBooking(int id, LocalisationModel<MemberBooking> memberBooking) { var memberId = WebHelper.GetIdentityId(User.Identity); var context = ModelFactory.GetUnitOfWork(); var bRepo = ModelFactory.GetRepository<IBookingRepository>(context); if (ModelState.IsValid) { try { var booking = bRepo.Get(id); TryUpdateModel(booking, "InnerModel"); booking.StatusId = (int)MemberBooking.Status.Accepted; booking.MemberBookingLogs.Add(new MemberBookingLog { CreatedDate = DateTime.UtcNow, Event = "Booking Confirmed", EventType = (int)MemberBookingLog.BookingEvent.Approval, LoggerId = memberId }); //send mail to owner //useless //send mail to client var urlHelp = new UrlHelper(ControllerContext.RequestContext); var userUrl = urlHelp.ActionAbsolute(MVC.Dashboard.Home.Booking()); TagBuilder userLink = new TagBuilder("a"); userLink.MergeAttribute("href", userUrl); userLink.InnerHtml = Worki.Resources.Views.Shared.SharedString.SpaceUser; var clientMailContent = string.Format(Worki.Resources.Email.BookingString.AcceptBookingClient, Localisation.GetOfferType(booking.Offer.Type), booking.GetStartDate(), booking.GetEndDate(), booking.Offer.Localisation.Name, booking.Offer.Localisation.Adress + ", " + booking.Offer.Localisation.PostalCode + " " + booking.Offer.Localisation.City, booking.Price, userLink); var clientMail = _EmailService.PrepareMessageFromDefault(new MailAddress( booking.Client.Email, booking.Client.MemberMainData.FirstName), Worki.Resources.Email.BookingString.AcceptBookingClientSubject, WebHelper.RenderEmailToString( booking.Client.MemberMainData.FirstName, clientMailContent)); context.Commit(); _EmailService.Deliver(clientMail); TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.Booking.BookingString.BookingAccepted; return RedirectToAction(MVC.Backoffice.Localisation.BookingDetail(booking.Id)); } catch (Exception ex) { _Logger.Error("ConfirmBooking", ex); context.Complete(); } } return View(memberBooking); }
public virtual ActionResult Add(int id, LocalisationModel<ProfilFormViewModel> formData) { //the other page that use the same models don't require the phonenumber, so we check only in this method if it's required if (String.IsNullOrEmpty(formData.InnerModel.Member.MemberMainData.PhoneNumber)) { ModelState.AddModelError("InnerModel.Member.MemberMainData.PhoneNumber", string.Format(Worki.Resources.Validation.ValidationString.Required, Worki.Resources.Models.Profile.Profile.PhoneNumber)); } if (ModelState.IsValid) { var memberId = WebHelper.GetIdentityId(User.Identity); var sendNewAccountMail = false; try { var clientId = 0; sendNewAccountMail = _MembershipService.TryCreateAccount(formData.InnerModel.Member.Email, formData.InnerModel.Member.MemberMainData, out clientId); var context = ModelFactory.GetUnitOfWork(); var mRepo = ModelFactory.GetRepository<IMemberRepository>(context); var lRepo = ModelFactory.GetRepository<ILocalisationRepository>(context); var localisation = lRepo.Get(id); var client = mRepo.Get(clientId); if (localisation.HasClient(clientId)) { throw new Exception(Worki.Resources.Views.BackOffice.BackOfficeString.ClientAlreadyExists); } try { localisation.LocalisationClients.Add(new LocalisationClient { ClientId = clientId }); TryUpdateModel(client, "InnerModel.Member"); object newMemberMail = null; if (sendNewAccountMail) { var urlHelper = new UrlHelper(ControllerContext.RequestContext); var editprofilUrl = urlHelper.ActionAbsolute(MVC.Dashboard.Profil.Edit()); TagBuilder profilLink = new TagBuilder("a"); profilLink.MergeAttribute("href", editprofilUrl); profilLink.InnerHtml = Worki.Resources.Views.Account.AccountString.EditMyProfile; var editpasswordUrl = urlHelper.ActionAbsolute(MVC.Dashboard.Profil.Edit()); TagBuilder passwordLink = new TagBuilder("a"); passwordLink.MergeAttribute("href", editpasswordUrl); passwordLink.InnerHtml = Worki.Resources.Views.Account.AccountString.ChangeMyPassword; var newMemberMailContent = string.Format(Worki.Resources.Email.BookingString.ClientCreationAccount, client.Email, _MembershipService.GetPassword(client.Email, null), passwordLink, profilLink); newMemberMail = _EmailService.PrepareMessageFromDefault(new MailAddress(client.Email, client.MemberMainData.FirstName), Worki.Resources.Email.BookingString.ClientCreationAccountSubject, WebHelper.RenderEmailToString(client.MemberMainData.FirstName, newMemberMailContent)); } context.Commit(); if (sendNewAccountMail) { _EmailService.Deliver(newMemberMail); } } catch (Exception ex) { _Logger.Error(ex.Message); context.Complete(); throw ex; } TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.BackOffice.BackOfficeString.ClientAdded; return RedirectToAction(MVC.Backoffice.Client.LocalisationList(id, null)); } catch (Exception ex) { _Logger.Error("Add", ex); ModelState.AddModelError("", ex.Message); } } return View(formData); }
public virtual ActionResult DeleteBooking(int id, LocalisationModel<RefuseBookingModel> formModel, string confirm) { if (string.IsNullOrEmpty(confirm)) { return Redirect(formModel.InnerModel.ReturnUrl); } var context = ModelFactory.GetUnitOfWork(); var bRepo = ModelFactory.GetRepository<IBookingRepository>(context); var memberId = WebHelper.GetIdentityId(User.Identity); if (ModelState.IsValid) { try { var booking = bRepo.Get(id); var offerId = booking.OfferId; var locId = booking.Offer.LocalisationId; bRepo.Delete(id); context.Commit(); TempData[MiscHelpers.TempDataConstants.Info] = "Résa supprimée"; return RedirectToAction(MVC.Backoffice.Schedule.OfferSchedule(locId, offerId)); } catch (Exception ex) { _Logger.Error("DeleteBooking", ex); context.Complete(); } } return View(formModel); }
public virtual ActionResult CreateBooking(int id) { var memberId = WebHelper.GetIdentityId(User.Identity); try { var context = ModelFactory.GetUnitOfWork(); var mRepo = ModelFactory.GetRepository<IMemberRepository>(context); var lRepo = ModelFactory.GetRepository<ILocalisationRepository>(context); var member = mRepo.Get(memberId); var localisation = lRepo.Get(id); Member.Validate(member); var model = new LocalisationModel<CreateBookingModel> { InnerModel = new CreateBookingModel(localisation), LocalisationModelId = id }; return View(model); } catch (Exception ex) { _Logger.Error("CreateBooking", ex); return View(MVC.Shared.Views.Error); } }
public void TestLocalizationParser() { LocalisationModel model = TestScriptToLocale(); TestLocaleToScript(model); }
public virtual ActionResult EditBooking(int id, LocalisationModel<CreateBookingModel> createBookingModel) { var context = ModelFactory.GetUnitOfWork(); var memberId = WebHelper.GetIdentityId(User.Identity); var bRepo = ModelFactory.GetRepository<IBookingRepository>(context); var booking = bRepo.Get(id); if (ModelState.IsValid) { try { TryUpdateModel(booking, "InnerModel.Booking"); if (booking.Paid) { booking.MemberBookingLogs.Add(new MemberBookingLog { CreatedDate = DateTime.UtcNow, Event = "Payment completed", EventType = (int)MemberBookingLog.BookingEvent.Payment, LoggerId = memberId }); } object clientMail = null; if (booking.StatusId == (int)MemberBooking.Status.Accepted) { //send mail to client var urlHelp = new UrlHelper(ControllerContext.RequestContext); var userUrl = urlHelp.ActionAbsolute(MVC.Dashboard.Home.Booking()); TagBuilder userLink = new TagBuilder("a"); userLink.MergeAttribute("href", userUrl); userLink.InnerHtml = Worki.Resources.Views.Shared.SharedString.SpaceUser; var clientMailContent = string.Format(Worki.Resources.Email.BookingString.AcceptBookingClient, Localisation.GetOfferType(booking.Offer.Type), booking.GetStartDate(), booking.GetEndDate(), booking.Offer.Localisation.Name, booking.Offer.Localisation.Adress + ", " + booking.Offer.Localisation.PostalCode + " " + booking.Offer.Localisation.City, booking.Price, userLink); clientMail = _EmailService.PrepareMessageFromDefault(new MailAddress(booking.Client.Email, booking.Client.MemberMainData.FirstName), Worki.Resources.Email.BookingString.AcceptBookingClientSubject, WebHelper.RenderEmailToString(booking.Client.MemberMainData.FirstName, clientMailContent)); } context.Commit(); if (booking.StatusId == (int)MemberBooking.Status.Accepted) { _EmailService.Deliver(clientMail); } var newContext = ModelFactory.GetUnitOfWork(); var newRepo = ModelFactory.GetRepository<IBookingRepository>(newContext); var newBooking = newRepo.Get(id); return RedirectToAction(MVC.Backoffice.Schedule.OfferSchedule(newBooking.Offer.LocalisationId, newBooking.OfferId)); } catch (Exception ex) { _Logger.Error("CreateEvent", ex); context.Complete(); } } createBookingModel.InnerModel.InitSelectLists(booking.Offer.Localisation); return View(MVC.Backoffice.Schedule.Views.CreateBooking, createBookingModel); }
public virtual ActionResult EditBooking(int id) { var memberId = WebHelper.GetIdentityId(User.Identity); try { var context = ModelFactory.GetUnitOfWork(); var bRepo = ModelFactory.GetRepository<IBookingRepository>(context); var booking = bRepo.Get(id); var model = new LocalisationModel<CreateBookingModel> { InnerModel = new CreateBookingModel(booking.Offer.Localisation, booking), LocalisationModelId = booking.Offer.LocalisationId }; return View(MVC.Backoffice.Schedule.Views.CreateBooking, model); } catch (Exception ex) { _Logger.Error("EditBooking", ex); return View(MVC.Shared.Views.Error); } }
public virtual ActionResult Edit(int id, int clientId, LocalisationModel<ProfilFormViewModel> formData) { if (ModelState.IsValid) { try { var context = ModelFactory.GetUnitOfWork(); var mRepo = ModelFactory.GetRepository<IMemberRepository>(context); var lRepo = ModelFactory.GetRepository<ILocalisationRepository>(context); var localisation = lRepo.Get(id); var client = mRepo.Get(clientId); try { TryUpdateModel(client, "InnerModel.Member"); context.Commit(); } catch (Exception ex) { _Logger.Error(ex.Message); context.Complete(); throw ex; } TempData[MiscHelpers.TempDataConstants.Info] = Worki.Resources.Views.BackOffice.BackOfficeString.ClientAdded; return RedirectToAction(MVC.Backoffice.Client.LocalisationList(id, null)); } catch (Exception ex) { _Logger.Error("Edit", ex); ModelState.AddModelError("", ex.Message); } } return View(MVC.Backoffice.Client.Views.Add, formData); }
public static string ParseLocalizationForCompare(LocalisationModel model) { LocalisationContainer container = new LocalisationContainer(model); return(Parse(container.LocalisationMap.ToList(), container.LanguageName)); }
public virtual ActionResult CreateBooking(int id, LocalisationModel<CreateBookingModel> createBookingModel) { if (ModelState.IsValid) { try { var booking = InternalCreateBooking(createBookingModel.InnerModel); return RedirectToAction(MVC.Backoffice.Schedule.OfferSchedule(booking.Offer.LocalisationId, booking.OfferId)); } catch (Exception ex) { _Logger.Error("CreateBooking", ex); } } var context = ModelFactory.GetUnitOfWork(); var lRepo = ModelFactory.GetRepository<ILocalisationRepository>(context); var localisation = lRepo.Get(id); createBookingModel.InnerModel.InitSelectLists(localisation); return View(createBookingModel); }