public OperationStatus SaveMyCurrentPosition(TrackMyPositionCustomModel model)
        {
            OperationStatus status = OperationStatus.Error;

            try
            {
                using (dbcontext = new AlertBackEntities())
                {
                    if (model.Id == 0)
                    {
                        tblTrackMyPosition _addMyPosition = new tblTrackMyPosition
                        {
                            MemberId    = model.MemberId,
                            Title       = model.Title,
                            Description = model.Description,
                            Image       = model.Image,
                            DDate       = model.DDate,
                            Longitude   = model.Longitude,
                            Latitude    = model.Latitude,
                            Place       = model.Place,

                            IsActive     = true,
                            IsDeleted    = false,
                            CreatedDate  = DateTime.Now,
                            CreatedBy    = model.CreatedBy,
                            ModifiedDate = DateTime.Now,
                            ModifiedBy   = model.ModifiedBy
                        };
                        dbcontext.tblTrackMyPositions.Add(_addMyPosition);
                        dbcontext.SaveChanges();
                        status = OperationStatus.Success;
                    }
                }
            }
            catch (Exception ex)
            {
                dbcontext.Dispose();
                status = OperationStatus.Exception;
                throw ex;
            }

            return(status);
        }
        /// <summary>
        /// This method is used to save new members
        /// </summary>
        /// <returns></returns>
        public OperationStatus SaveApplicationUser(ApplicationUserModel applicationUserModel)
        {
            OperationStatus status = OperationStatus.Error;

            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    using (dbcontext = new AlertBackEntities())
                    {
                        if (applicationUserModel.ApplicationUserId == 0)
                        {
                            var rs = dbcontext.tblApplicationUsers.FirstOrDefault(x => x.UserName == applicationUserModel.UserName && x.IsDeleted == false);
                            if (rs == null)
                            {
                                tblMember _addMember = new tblMember
                                {
                                    Name        = applicationUserModel.Name,
                                    EmailId     = applicationUserModel.EmailId,
                                    MobileNo    = applicationUserModel.MobileNo,
                                    Gender      = applicationUserModel.Gender,
                                    DateOfBirth = applicationUserModel.DateOfBirth,
                                    Address     = applicationUserModel.Address,
                                    FatherName  = applicationUserModel.FatherName,
                                    MotherName  = applicationUserModel.MotherName,

                                    IsActive     = true,
                                    IsDeleted    = false,
                                    CreatedDate  = DateTime.Now,
                                    CreatedBy    = applicationUserModel.CreatedBy,
                                    ModifiedDate = DateTime.Now,
                                    ModifyBy     = applicationUserModel.ModifyBy,
                                };
                                dbcontext.tblMembers.Add(_addMember);
                                dbcontext.SaveChanges();
                                int userid = _addMember.MemberId;

                                tblApplicationUser _applicationUserinfo = new tblApplicationUser
                                {
                                    Name        = applicationUserModel.Name,
                                    EmailId     = applicationUserModel.EmailId,
                                    MobileNo    = applicationUserModel.MobileNo,
                                    Gender      = applicationUserModel.Gender,
                                    DateOfBirth = applicationUserModel.DateOfBirth,
                                    Address     = applicationUserModel.Address,

                                    UserIdentityKey = userid,
                                    UserName        = applicationUserModel.UserName,
                                    Password        = applicationUserModel.Password,

                                    IsActive     = true,
                                    IsDeleted    = false,
                                    CreatedDate  = DateTime.Now,
                                    CreatedBy    = applicationUserModel.CreatedBy,
                                    ModifiedDate = DateTime.Now,
                                    ModifyBy     = applicationUserModel.ModifyBy,
                                };

                                dbcontext.tblApplicationUsers.Add(_applicationUserinfo);
                                dbcontext.SaveChanges();

                                status = OperationStatus.Success;
                                ts.Complete();
                            }
                            else
                            {
                                status = OperationStatus.Duplicate;
                                //ts.Dispose();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    dbcontext.Dispose();
                    status = OperationStatus.Exception;
                    ts.Dispose();
                    throw ex;
                }
            }
            return(status);
        }