protected async System.Threading.Tasks.Task Form0Submit(InnovationWebApp.Models.InnovateDb.Idea args)
        {
            try
            {
                if (isEdit)
                {
                    var innovateDbUpdateIdeaResult = await InnovateDb.UpdateIdea(idea.id, idea);

                    NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Idea updated!");
                }
            }
            catch (System.Exception innovateDbUpdateIdeaException)
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to update Idea");
            }

            try
            {
                if (!this.isEdit)
                {
                    var innovateDbCreateIdeaResult = await InnovateDb.CreateIdea(args);

                    idea = new InnovationWebApp.Models.InnovateDb.Idea();

                    NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Idea created!");
                }
            }
            catch (System.Exception innovateDbCreateIdeaException)
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to create new Idea!");
            }
        }
예제 #2
0
        public async Task <Models.InnovateDb.Idea> CancelIdeaChanges(Models.InnovateDb.Idea item)
        {
            var entity = context.Entry(item);

            entity.CurrentValues.SetValues(entity.OriginalValues);
            entity.State = EntityState.Unchanged;

            return(item);
        }
예제 #3
0
        public async Task <Models.InnovateDb.Idea> CreateIdea(Models.InnovateDb.Idea idea)
        {
            OnIdeaCreated(idea);

            context.Ideas.Add(idea);
            context.SaveChanges();

            OnAfterIdeaCreated(idea);

            return(idea);
        }
        protected async System.Threading.Tasks.Task IdeaSubmit(InnovationWebApp.Models.InnovateDb.Idea args)
        {
            try
            {
                var innovateDbCreateIdeaResult = await InnovateDb.CreateIdea(idea);

                NotificationService.Notify(NotificationSeverity.Success, $"Success", $"Your idea has been recorded");
                DialogService.Close(idea);
                UriHelper.NavigateTo("welcome");
            }
            catch (System.Exception innovateDbCreateIdeaException)
            {
                NotificationService.Notify(NotificationSeverity.Error, $"Error", $"Unable to create new Idea!");
            }
        }
예제 #5
0
        public async Task <Models.InnovateDb.Idea> UpdateIdea(int?id, Models.InnovateDb.Idea idea)
        {
            OnIdeaUpdated(idea);

            var item = context.Ideas
                       .Where(i => i.id == id)
                       .FirstOrDefault();

            if (item == null)
            {
                throw new Exception("Item no longer available");
            }
            var entry = context.Entry(item);

            entry.CurrentValues.SetValues(idea);
            entry.State = EntityState.Modified;
            context.SaveChanges();

            OnAfterIdeaUpdated(idea);

            return(idea);
        }
        protected async System.Threading.Tasks.Task Grid0RowSelect(InnovationWebApp.Models.InnovateDb.Idea args)
        {
            isEdit = true;

            idea = args;
        }
 protected async System.Threading.Tasks.Task Load()
 {
     idea = new InnovationWebApp.Models.InnovateDb.Idea()
     {
     };
 }
예제 #8
0
 partial void OnAfterIdeaCreated(Models.InnovateDb.Idea item);
예제 #9
0
 partial void OnIdeaUpdated(Models.InnovateDb.Idea item);
예제 #10
0
 partial void OnIdeaGet(Models.InnovateDb.Idea item);
예제 #11
0
 partial void OnIdeaDeleted(Models.InnovateDb.Idea item);