public async Task <ActionResult> Create(GroupCreateModel Model) { if (ModelState.IsValid) { GroupAddRequest gar = new GroupAddRequest() { CourseCode = Model.CourseCode, GroupCode = Model.CourseCode + DateTime.UtcNow.ToString("MMddyyHmmss"), GroupName = Model.GroupName, GroupTypeCode = Model.GroupTypeCode, Objective = Model.Objective, TimeZone = Model.TimeZone, userList = new List <string>() { User.Identity.Name } }; bool resp = _groupCom.AddGroup(gar); if (resp) { return(RedirectToAction("GroupDetail", "Group", routeValues: new { groupCode = gar.GroupCode })); } } ModelState.AddModelError("", "Oops! Something wrong happened! Please try again."); return(View(Model)); }
public GroupAddResult AddGroup(string groupName) { var url = $"{this._baseUrl}/groups/addGroup/"; var request = new GroupAddRequest { ApiKey = this._apiKey, GroupName = groupName }; var xmlRequest = this._parser.Serialize(request); var httpResponse = this._httpClient.Request(url, xmlRequest); if (httpResponse.Status != HttpStatus.Successful) { return(new GroupAddResult { Status = Status.Error, Message = "Http error" }); } var groupResult = this._parser.Deserialize <GroupAddResult>(httpResponse.Result); return(groupResult); }
public async Task <IResponseEntity> CreateAsync(GroupAddRequest req) { var item = _mapper.Map <SysGroupEntity>(req); var result = await _sysGroupRepository.InsertAsync(item); //清除缓存 await _cache.RemoveByPatternAsync(CacheKeyTemplate.GroupList); return(ResponseEntity.Result(result != null && result?.Id != "")); }
public bool AddGroup(GroupAddRequest request) { try { group.Add(request); return(true); } catch { return(false); } }
public void SerializeGroupAddRequest() { IXmlParser xmlParser = new DefaultXmlParser(); var request = new GroupAddRequest { ApiKey = "44-121312131223", GroupName = "My New Group" }; var requestXml = xmlParser.Serialize(request); var xml = File.ReadAllText("GroupRequestName.xml"); Assert.AreEqual(xml, requestXml); }
public GroupAddResponse GroupAdd(GroupAddRequest request) { try { return(new GroupAddResponse() { Id = DB.GroupAdd(request.Name, request.Words), }); } catch (Exception ex) { return(new GroupAddResponse() { Id = Guid.Empty, }); } }
void FabNext_Click(object sender, EventArgs e) { if (StringCheckUtil.isEmpty(txtGroupName)) { return; } var model = new GroupAddRequest() { GROUP_NAME = txtGroupName.Text.Trim(), MY_USER_ID = ParentActivity.MyApplication.Me.USERID, TOKEN = ParentActivity.MyApplication.Me.TOKEN, OWNER_NAME = ParentActivity.MyApplication.Me.NAME }; ViewModel.AddGroupItemCommand.Execute(model); }
public async Task <RepositoryGroup> Add(GroupAddRequest groupAddRequest) { var existingGroup = _fileRepository.GetGroup(groupAddRequest.GroupName) ?? new RepositoryGroup { GroupName = groupAddRequest.GroupName }; var toAdd = groupAddRequest.RepositorySlugs.Where(w => !existingGroup.RepositorySlugs.Contains(w)); var(repositoriesThatExist, repositoriesThatDoNotExist) = _repositoryProvider.RepositoriesExist(toAdd).SplitExistingAndNonExisting(); if (repositoriesThatDoNotExist.Any() && !_continueEvent.Continue($"Could not find slugs: {string.Join(", ", repositoriesThatDoNotExist)}. Continue? ")) { return(existingGroup); } existingGroup.RepositorySlugs.AddRange(repositoriesThatExist); return(_fileRepository.WriteGroup(existingGroup)); }
public DomainModelResponse Add(GroupAddRequest request) { Group grp = new Group() { GroupCode = request.GroupCode, GroupName = request.GroupName, Objective = request.Objective, TimeZone = request.TimeZone }; GroupType gt = _repGroupType.Get(filter: f => f.GroupTypeCode == request.GroupTypeCode).FirstOrDefault(); Course crs = _repCourse.Get(filter: f => f.CourseCode == request.CourseCode).FirstOrDefault(); grp.GroupTypeId = gt.GroupTypeId; grp.GroupType = gt; grp.CourseId = crs.CourseId; grp.Course = crs; _repGroup.Add(grp); _uow.Commit(); grp = _repGroup.Get(filter: f => f.GroupCode == request.GroupCode).FirstOrDefault(); if (request.userList != null) { List <string> users = _repUserProfile.Get(filter: f => request.userList.Contains(f.Email)).Select(x => x.Id).ToList(); List <EntityModel.CourseUser> Curs = _repCourseUserRole.Get(filter: f => f.CourseId == crs.CourseId && users.Contains(f.UserId)).ToList(); foreach (EntityModel.CourseUser cur in Curs) { cur.GroupId = grp.GroupId; cur.Group = grp; _repCourseUserRole.Update(cur); } } _uow.Commit(); _groupResponse.addResponse("Add", MessageCodes.InfoCreatedSuccessfully, "Group : " + request.GroupCode); return(_groupResponse); }
/// <summary> /// 添加分组:group_add /// </summary> /// <param name="request"></param> /// <returns></returns> public async Task <GroupAddResult> GroupAddAsync(GroupAddRequest request) { return(await RequestAsync <GroupAddRequest, GroupAddResult>(ServiceName, "group_add", request)); }
public async Task <IResponseEntity> Create(GroupAddRequest req) { return(await _sysGroupService.CreateAsync(req)); }
public virtual GroupAddResult GroupAdd(GroupAddRequest request) { return(Request <GroupAddResult>("sns", "group_add", request)); }