private static Domain.Socioboard.Domain.Groups AddGroupByUserId(Guid userId) { Domain.Socioboard.Domain.Groups groups = new Domain.Socioboard.Domain.Groups(); GroupsRepository objGroupRepository = new GroupsRepository(); UserRepository userRepo = new UserRepository(); GroupMembersRepository grpMemberRepo = new GroupMembersRepository(); groups.Id = Guid.NewGuid(); groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"]; groups.UserId = userId; groups.EntryDate = DateTime.UtcNow; objGroupRepository.AddGroup(groups); Domain.Socioboard.Domain.User objUser = userRepo.getUsersById(groups.UserId); Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Groupid = groups.Id.ToString(); grpMember.Userid = groups.UserId.ToString(); grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted; grpMember.Emailid = objUser.EmailId; grpMember.IsAdmin = true; grpMemberRepo.AddGroupMemeber(grpMember); return(groups); }
public IHttpActionResult AddGroup(Domain.Socioboard.Domain.Groups group) { try { // GroupRepository grouprepo = new GroupRepository(); if (!grouprepo.checkGroupExists(group.UserId, group.GroupName)) { // Domain.Socioboard.Domain.Groups group = new Domain.Socioboard.Domain.Groups(); group.EntryDate = DateTime.UtcNow; group.Id = Guid.NewGuid(); grouprepo.AddGroup(group); //code to add admin as group member Domain.Socioboard.Domain.User objUser = objUserRepository.getUsersById(group.UserId); Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Groupid = group.Id.ToString(); grpMember.Userid = group.UserId.ToString(); grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted ; grpMember.Emailid = objUser.EmailId; grpMember.IsAdmin = true; grpMemberRepo.AddGroupMemeber(grpMember); Api.Socioboard.Services.BusinessSetting ApiobjBusinesssSetting = new Api.Socioboard.Services.BusinessSetting(); Domain.Socioboard.Domain.BusinessSetting ObjBsnsStng = new Domain.Socioboard.Domain.BusinessSetting(); ObjBsnsStng.Id = Guid.NewGuid(); ObjBsnsStng.BusinessName = group.GroupName; ObjBsnsStng.GroupId = group.Id; ObjBsnsStng.AssigningTasks = false; ObjBsnsStng.TaskNotification = false; ObjBsnsStng.FbPhotoUpload = 0; ObjBsnsStng.UserId = group.UserId; ObjBsnsStng.EntryDate = DateTime.Now; string ObjBsnsStg = (new JavaScriptSerializer().Serialize(ObjBsnsStng)); string BsnsMessage = ApiobjBusinesssSetting.AddBusinessByUser(ObjBsnsStg); //return new JavaScriptSerializer().Serialize(group); return Ok("Added Sucessfully"); } else { return BadRequest("Group Exist."); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return BadRequest("Group Exist."); } }
public IHttpActionResult AddGroup(Domain.Socioboard.Domain.Groups group) { try { // GroupRepository grouprepo = new GroupRepository(); if (!grouprepo.checkGroupExists(group.UserId, group.GroupName)) { // Domain.Socioboard.Domain.Groups group = new Domain.Socioboard.Domain.Groups(); group.EntryDate = DateTime.UtcNow; group.Id = Guid.NewGuid(); grouprepo.AddGroup(group); //code to add admin as group member Domain.Socioboard.Domain.User objUser = objUserRepository.getUsersById(group.UserId); Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Groupid = group.Id.ToString(); grpMember.Userid = group.UserId.ToString(); grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted; grpMember.Emailid = objUser.EmailId; grpMember.IsAdmin = true; grpMemberRepo.AddGroupMemeber(grpMember); Api.Socioboard.Services.BusinessSetting ApiobjBusinesssSetting = new Api.Socioboard.Services.BusinessSetting(); Domain.Socioboard.Domain.BusinessSetting ObjBsnsStng = new Domain.Socioboard.Domain.BusinessSetting(); ObjBsnsStng.Id = Guid.NewGuid(); ObjBsnsStng.BusinessName = group.GroupName; ObjBsnsStng.GroupId = group.Id; ObjBsnsStng.AssigningTasks = false; ObjBsnsStng.TaskNotification = false; ObjBsnsStng.FbPhotoUpload = 0; ObjBsnsStng.UserId = group.UserId; ObjBsnsStng.EntryDate = DateTime.Now; string ObjBsnsStg = (new JavaScriptSerializer().Serialize(ObjBsnsStng)); string BsnsMessage = ApiobjBusinesssSetting.AddBusinessByUser(ObjBsnsStg); //return new JavaScriptSerializer().Serialize(group); return(Ok("Added Sucessfully")); } else { return(BadRequest("Group Exist.")); } } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(BadRequest("Group Exist.")); } }
private static Domain.Socioboard.Domain.Groups AddGroupByUserId(Guid userId) { Domain.Socioboard.Domain.Groups groups = new Domain.Socioboard.Domain.Groups(); GroupsRepository objGroupRepository = new GroupsRepository(); UserRepository userRepo = new UserRepository(); GroupMembersRepository grpMemberRepo = new GroupMembersRepository(); groups.Id = Guid.NewGuid(); groups.GroupName = ConfigurationManager.AppSettings["DefaultGroupName"]; groups.UserId = userId; groups.EntryDate = DateTime.UtcNow; objGroupRepository.AddGroup(groups); Domain.Socioboard.Domain.User objUser = userRepo.getUsersById(groups.UserId); Domain.Socioboard.Domain.Groupmembers grpMember = new Domain.Socioboard.Domain.Groupmembers(); grpMember.Id = Guid.NewGuid(); grpMember.Groupid = groups.Id.ToString(); grpMember.Userid = groups.UserId.ToString(); grpMember.Status = Domain.Socioboard.Domain.GroupUserStatus.Accepted; grpMember.Emailid = objUser.EmailId; grpMember.IsAdmin = true; grpMemberRepo.AddGroupMemeber(grpMember); return groups; }