public ActionResult Details(int id)
 {
     if (id != null && id != 0)
     {
         _AddMasjid = _AddMasjidBusiness.GetById(id);
     }
     return(View(_AddMasjid));
 }
 public ActionResult Create(AddMasjid model)
 {
     if (model != null)
     {
         _AddMasjidBusiness.SaveMasjid(model);
     }
     return(RedirectToAction("Index"));
 }
 public tbl_AddMasjid(AddMasjid _obj)
 {
     Id          = _obj.Id;
     MasjidName  = _obj.MasjidName;
     SadarUserId = _obj.SadarUserId;
     HalqaId     = _obj.HalqaId;
     Lattitude   = _obj.Lattitude;
     Longitude   = _obj.Longitude;
     CreatedBy   = _obj.CreatedBy;
     CreatedDate = _obj.CreatedDate;
     Status      = _obj.Status;
 }
        public AddMasjid GetMasjidDetails(AddMasjid model)
        {
            model = model ?? new AddMasjid();
            if (model.Id != 0)
            {
                model.AddMasjidList = MasjidList();
                model.AddHalqaList  = HalqaList();
                model.UserList      = UserList();
            }
            model.AddMasjidList = MasjidList();

            return(model);
        }
        public void Delete(AddMasjid entity)
        {
            tbl_AddMasjid AddMasjidData = new tbl_AddMasjid(entity);

            using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
            {
                if (entity.Id != null && entity.Id != 0)
                {
                    _tbl_AddMasjid.Delete(AddMasjidData.Id);
                }
                scope.Complete();
            }
        }
 public ActionResult Create(int?id)
 {
     if (id != null)
     {
         _AddMasjid = _AddMasjidBusiness.GetById(Convert.ToInt32(id));
         _AddMasjid.AddHalqaList = _AddMasjidBusiness.HalqaList().ToList();
         _AddMasjid.UserList     = _AddMasjidBusiness.UserList().ToList();
     }
     else
     {
         _AddMasjid.AddMasjidList = _AddMasjidBusiness.MasjidList().ToList();
         _AddMasjid.AddHalqaList  = _AddMasjidBusiness.HalqaList().ToList();
         _AddMasjid.UserList      = _AddMasjidBusiness.UserList().ToList();
     }
     return(View(_AddMasjid));
 }
        public int SaveMasjid(AddMasjid model)
        {
            tbl_AddMasjid _tbl_addmasjid = new tbl_AddMasjid(model);

            if (model.Id != null && model.Id != 0)
            {
                _tbl_addmasjid.Status = true;
                _tbl_AddMasjid.Update(_tbl_addmasjid);
            }
            else
            {
                _tbl_addmasjid.CreatedBy   = 1;
                _tbl_addmasjid.CreatedDate = System.DateTime.Now;
                _tbl_addmasjid.Status      = true;
                _tbl_addmasjid             = _tbl_AddMasjid.Insert(_tbl_addmasjid);
            }

            return(_tbl_addmasjid.Id);
        }
        public AddMasjid GetById(int id)
        {
            AddMasjid _AddMasjid = new AddMasjid();
            var       MasjidbyId = _tbl_AddMasjid.GetById(id);

            MasjidbyId = MasjidbyId ?? new tbl_AddMasjid();
            _AddMasjid = new AddMasjid
            {
                Id            = MasjidbyId.Id,
                MasjidName    = MasjidbyId.MasjidName,
                SadarUserId   = MasjidbyId.SadarUserId,
                SadarUserName = (MasjidbyId.tbl_User != null) ? MasjidbyId.tbl_User.Name : string.Empty,
                HalqaId       = MasjidbyId.HalqaId,
                HalqaName     = (MasjidbyId.tbl_AddHalqa != null) ? MasjidbyId.tbl_AddHalqa.HalqaName : string.Empty,
                Lattitude     = MasjidbyId.Lattitude,
                Longitude     = MasjidbyId.Longitude,
                CreatedBy     = MasjidbyId.CreatedBy,
                CreatedDate   = MasjidbyId.CreatedDate,
                Status        = MasjidbyId.Status
            };
            return(_AddMasjid);
        }
 public AddMasjidBusiness()
 {
     _tbl_AddMasjid = new GenericPattern <tbl_AddMasjid>();
     _AddMasjid     = new AddMasjid();
 }
 public AddMasjidController()
 {
     _AddMasjid         = new AddMasjid();
     _AddMasjidBusiness = new AddMasjidBusiness();
 }