예제 #1
0
        private void TombolHotline_Click(object sender, EventArgs e)
        {
            Hotline UC = new Hotline();

            //CHECKING WHETHER THE FORM HAS BEEN OPENED OR NOT YET
            if (Application.OpenForms["Hotline"] == null)
            {
                Notification("Kamu membuka form Hotline Indonesia", ModernNotification.NotifTypeEnum.Default);
                UC.Show();
            }
            else
            {
                Notification("Form sudah terbuka, jangan dibuka lagi", ModernNotification.NotifTypeEnum.Default);
            }
        }
예제 #2
0
        public bool CreateHotline(HotlineCreate model)
        {
            var entity =
                new Hotline()
            {
                Name           = model.Name,
                PhoneNumber    = model.PhoneNumber,
                Website        = model.Website,
                IsTextFriendly = model.IsTextFriendly,
                IsMultilingual = model.IsMultilingual,
                Details        = model.Details
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.Hotlines.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }