Ejemplo n.º 1
0
        public void DeleteAd(IAdView AdView)
        {
            AdController AdController = new AdController();

            AdController.DeleteAd(AdView, AdRepository, GetAd(AdView.AdId, AdRepository));
            ShowMainForm();
        }
Ejemplo n.º 2
0
        public void UpdateAd(IAdView AdView)
        {
            AdController AdController = new AdController();

            if (AdController.UpdateAd(AdView, AdRepository, GetAd(AdView.AdId, AdRepository)) == false)
            {
                return;
            }
            ShowMainForm();
        }
Ejemplo n.º 3
0
        public void CreateAd(IAdView AdForm)
        {
            AdController AdController = new AdController();

            if (AdController.CreateAd(AdForm, UserRepository, CurrentUser) == null)
            {
                return;
            }

            ShowMainForm();
        }
Ejemplo n.º 4
0
        public void ShowAdForm(IMainView MainView)
        {
            var frm = (Form)MainView;

            frm.Hide();

            AdController AdController = new AdController();
            AdForm       AdForm       = (AdForm)WindowFormsFactory.CreateAdView(this);

            AdForm.AdjustCreateView();

            AdController.ShowAdForm(AdForm);
        }
Ejemplo n.º 5
0
        public void ShowAdForm(int Id, IMainView MainView)
        {
            if (CurrentUser == null)
            {
                MessageBox.Show("Morate biti prijavljeni da biste vidjeli cijeli oglas");
                return;
            }

            var frm = (Form)MainView;

            frm.Hide();

            AdForm AdForm = (AdForm)WindowFormsFactory.CreateAdView(this);

            WalkerAd no = AdRepository.GetWalkerAd(Id);

            if (no != null)
            {
                AdForm.HideCreate();
            }

            OwnerAd po = AdRepository.GetOwnerAd(Id);

            if (po != null)
            {
                AdForm.HideCreate();
            }

            if (no == null && po == null)
            {
                AdForm.AdjustCreateView();
            }

            if (CurrentUser == null)
            {
                MessageBox.Show("Morate biti prijavljeni da biste vidjeli cijeli oglas");
                return;
            }


            if (GetOwner(Id, AdRepository).Username != CurrentUser.Username)
            {
                AdForm.NotUsersAd();
            }



            AdController AdController = new AdController();

            AdController.ShowAdForm(AdForm, Id, UserRepository, AdRepository, CurrentUser);
        }
Ejemplo n.º 6
0
 public void ShowCreateAdForm()
 {
     AdController AdController = new AdController();
 }