Ejemplo n.º 1
0
        public async Task <ActionResult <LGA> > PostLGA(LGA lGA)
        {
            _context.LGAs.Add(lGA);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLGA", new { id = lGA.Id }, lGA));
        }
Ejemplo n.º 2
0
 public static void ConfigureAppModel(this ModelBuilder builder)
 {
     AppUserProfile.ConfigureFluent(builder);
     AppUserBank.ConfigureFluent(builder);
     AppUserRole.ConfigureFluent(builder);
     AppUserFile.ConfigureFluent(builder);
     Bank.ConfigureFluent(builder);
     Country.ConfigureFluent(builder);
     State.ConfigureFluent(builder);
     LGA.ConfigureFluent(builder);
     Staff.ConfigureFluent(builder);
     Supplier.ConfigureFluent(builder);
     BillPayable.ConfigureFluent(builder);
     BillReceivable.ConfigureFluent(builder);
     Journal.ConfigureFluent(builder);
     JournalLineItem.ConfigureFluent(builder);
     Payment.ConfigureFluent(builder);
     Receipt.ConfigureFluent(builder);
     PayableWorkFlow.ConfigureFluent(builder);
     ReceivableWorkFlow.ConfigureFluent(builder);
     AccountGroup.ConfigureFluent(builder);
     AccountSubType.ConfigureFluent(builder);
     LineItem.ConfigureFluent(builder);
     BankAccount.ConfigureFluent(builder);
     AppData.ConfigureFluent(builder);
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create(LGA lga)
        {
            if (ModelState.IsValid)
            {
                var allLga = await _database.Lgas.Where(l => l.StateId == lga.StateId).ToListAsync();

                if (allLga.Any(b => b.Name == lga.Name))
                {
                    TempData["lga"] = "You cannot add " + lga.Name + " as a local government area because it already exist!!!";
                    TempData["notificationType"] = NotificationType.Error.ToString();
                    return(Json(new { success = true }));
                }

                var _lga = new LGA()
                {
                    Name             = lga.Name,
                    StateId          = lga.StateId,
                    CreatedBy        = Convert.ToInt32(_session.GetInt32("imouloggedinuserid")),
                    DateCreated      = DateTime.Now,
                    LastModifiedBy   = Convert.ToInt32(_session.GetInt32("imouloggedinuserid")),
                    DateLastModified = DateTime.Now
                };

                await _database.Lgas.AddAsync(_lga);

                await _database.SaveChangesAsync();

                TempData["lga"] = "You have successfully added " + lga.Name + " Local Government Area.";
                TempData["notificationType"] = NotificationType.Success.ToString();

                return(Json(new { success = true }));
            }
            ViewBag.StateId = new SelectList(_database.States, "StateId", "Name", lga.StateId);
            return(View("Index"));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> PutLGA(int id, LGA lGA)
        {
            if (id != lGA.Id)
            {
                return(BadRequest());
            }

            _context.Entry(lGA).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LGAExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 5
0
        private List <LGA> GetLgas(string stateId)
        {
            if (string.IsNullOrEmpty(stateId))
            {
                return(null);
            }

            List <LGA> lgas = LGA.GetLGAs(stateId).OrderBy(l => l.LGAName).ToList();

            return(lgas);
        }
        private void LoadAddressLgas(string stateId)
        {
            AddressLgaCombo.Items.Clear();

            if (string.IsNullOrEmpty(stateId))
            {
                return;
            }

            AddressLgaCombo.DataSource = LGA.GetLGAs(stateId).OrderBy(l => l.LGAName);
            AddressLgaCombo.TextField  = "LGAName";
            AddressLgaCombo.ValueField = "LGAId";
            AddressLgaCombo.DataBind();
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create()
        {
            var userid = _session.GetInt32("imouloggedinuserid");
            var _user  = await _database.ApplicationUsers.FindAsync(userid);

            var roleid = _user.RoleId;
            var role   = _database.Roles.Find(roleid);

            if (role.CanManageLocation == false && role.CanDoEverything == false)
            {
                return(RedirectToAction("Index", "Error"));
            }

            var lga = new LGA();

            ViewBag.StateId = new SelectList(_database.States, "StateId", "Name");
            return(PartialView("Create", lga));
        }
        /// <summary>
        /// Update Profile entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Profile Create(ProfileModel model, LGA theLGA, User theUser)
        {
            return(new Profile()
            {
                Id = model.Id,
                FirstName = model.FirstName,
                LastName = model.LastName,
                Hobby = model.Hobby,
                Profession = model.Profession,
                MaritalStatus = model.MaritalStatus,
                Gender = model.Gender,
                TheLGA = theLGA,
                TheUser = theUser,

                IsApproved = model.IsApproved,
                ModifiedAt = DateTime.Now,
                RecordStatus = model.RecordStatus
            });
        }
        /// <summary>
        /// Create Profile entity
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static Profile Create(ProfileMiniModel model, LGA theLGA, User theUser)
        {
            return(new Profile()
            {
                FirstName = model.FirstName,
                LastName = model.LastName,
                Hobby = model.Hobby,
                Profession = model.Profession,
                MaritalStatus = model.MaritalStatus,
                Gender = model.Gender,
                TheLGA = theLGA,
                TheUser = theUser,

                Id = Guid.NewGuid().ToString(),
                CreatedAt = DateTime.Now,
                IsApproved = true,
                ModifiedAt = DateTime.MinValue,
                RecordStatus = RecordStatus.ACTIVE
            });
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> Edit(int id, LGA lga)
        {
            if (id != lga.LGAId)
            {
                return(RedirectToAction("Index", "Error"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    lga.LastModifiedBy   = Convert.ToInt32(_session.GetInt32("imouloggedinuserid"));
                    lga.DateLastModified = DateTime.Now;

                    _database.Update(lga);
                    await _database.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LGAExists(lga.LGAId))
                    {
                        return(RedirectToAction("Index", "Error"));
                    }
                    else
                    {
                        throw;
                    }
                }

                TempData["lga"] = "You have successfully modified " + lga.Name + " Local government area.";
                TempData["notificationType"] = NotificationType.Success.ToString();

                return(Json(new { success = true }));
            }
            ViewBag.StateId = new SelectList(_database.States, "StateId", "Name", lga.StateId);
            return(View(lga));
        }
        public List <Profile> Search(string name, string email, Country theCountry, State theState, LGA theLGA, RecordStatus?status)
        {
            var _recordStatus = status == null ? -1 : (int)status;

            var table = Query();

            var query = from a in table
                        where (theLGA == null || a.TheLGA.Equals(theLGA)) &&
                        (theState == null || a.TheLGA.TheState.Equals(theState)) &&
                        (theCountry == null || a.TheLGA.TheState.TheCountry.Equals(theCountry)) &&
                        (string.IsNullOrEmpty(name) || a.LastName.ToLower().Contains(name.ToLower())) &&
                        (string.IsNullOrEmpty(name) || a.FirstName.ToLower().Contains(name.ToLower())) &&
                        (string.IsNullOrEmpty(name) || a.TheUser.UserName.ToLower().Contains(name.ToLower())) &&
                        (string.IsNullOrEmpty(email) || a.TheUser.Email.ToLower().Contains(email.ToLower())) &&
                        (_recordStatus < 0 || a.RecordStatus == (RecordStatus)_recordStatus)
                        select a;

            return(query.ToList <Profile>());
        }