public async Task <ActionResult> List([FromQuery] ContactListRequest rq) { try { ContactListResponse rs = await(new ContactListService(this.Context, _contactRepo)).RunAsync(rq); return(new ApiActionResult(this.Context.Request, rs)); } catch (Exception ex) { return(new ApiActionResult(this.Context.Request, ex)); } }
public List <Contacts> ContactList(ContactListRequest Model) { List <Contacts> List = new List <Contacts>(); try { SqlCon.Open(); var SqlCmd = new SqlCommand("[config].[uspReadContacts]", SqlCon) { CommandType = CommandType.StoredProcedure }; SqlCmd.Parameters.AddWithValue("@HistoryFlag", Model.HistoryFlag); SqlCmd.Parameters.AddWithValue("@ContactTypeID", Model.ContactTypeID); using (var dr = SqlCmd.ExecuteReader()) { while (dr.Read()) { var detail = new Contacts { ContactID = Convert.ToInt32(dr["ContactID"]), Requester = dr["Requester"].ToString(), Email = dr["Email"].ToString(), PhoneNumber = dr["PhoneNumber"].ToString(), ContactTypeID = Convert.ToInt32(dr["ContactTypeID"]), Reason = dr["Reason"].ToString(), InsertDate = Convert.ToDateTime(dr["InsertDate"]), IP = dr["IP"].ToString(), Country = dr["Country"].ToString(), Region = dr["Region"].ToString(), City = dr["City"].ToString() }; List.Add(detail); } } if (SqlCon.State == ConnectionState.Open) { SqlCon.Close(); } } catch (Exception ex) { throw ex; } if (SqlCon.State == ConnectionState.Open) { SqlCon.Close(); } return(List); }
public ActionResult ContactsPrintVersion(bool historyflag, int contacttypeid) { var CLR = new ContactListRequest() { ContactTypeID = contacttypeid, HistoryFlag = historyflag }; var CTDetails = CBL.Details(contacttypeid); CTDetails.HistoryFlag = historyflag; CTDetails.ContactList = CBL.ContactList(CLR); return(View(CTDetails)); }
public HttpResponseMessage List([FromBody] ContactListRequest model) { var CT = CBL.Details(model.ContactTypeID); CT.ContactList = CBL.ContactList(model); if (CT.ContactTypeID > 0) { return(this.Request.CreateResponse(HttpStatusCode.OK, CT)); } else { return(this.Request.CreateResponse(HttpStatusCode.NotFound)); } }
public ActionResult ContactsPDF(bool historyflag, int contacttypeid) { var CLR = new ContactListRequest() { ContactTypeID = contacttypeid, HistoryFlag = historyflag }; var CTDetails = CBL.Details(contacttypeid); CTDetails.HistoryFlag = historyflag; CTDetails.ContactList = CBL.ContactList(CLR); string filename = CTDetails.TypeTitle + "_" + DateTime.Today.ToString("dd_MM_yyyy") + ".pdf"; return(new ViewAsPdf("ContactsPrintVersion", CTDetails) { FileName = filename }); }
public ContactListResponse ContactList([FromBody] ContactListRequest request) { //Instantiate database using var db = new DbModel(); //Select to database where Contacts do have required UserId var list = db.Contacts.Where(b => b.UserId == request.UserID) .Select(c => new ContactListResponse.Contact { ContactId = c.ContactId, Email = c.Email, Name = c.Name, UserId = c.UserId, Surname = c.Surname, Company = c.Company }) .ToList(); return(new ContactListResponse() { List = list }); }
public string getContactListRequest(ContactListProp contactListProp) { ContactListRequest contactListRequest = new ContactListRequest(contactListProp); return(objToJson <ContactListRequest>(contactListRequest)); }
public IRequest CreateRequestByString(string requestString) { IRequest request = new EmptyRequest(); // checking status requests switch (requestString) { case AUTH_SUCCESS: request = new StatusRequest(requestString, RequestType.AuthSuccess); break; case AUTH_FAILED: request = new StatusRequest(requestString, RequestType.AuthFailed); break; case REGISTRATION_SUCCESS: request = new StatusRequest(requestString, RequestType.RegistationSuccess); break; case REGISTRATION_FAILED: request = new StatusRequest(requestString, RequestType.RegistationFailed); break; case ADD_SUCCESS: request = new StatusRequest(requestString, RequestType.AddSuccess); break; case ADD_FAILED: request = new StatusRequest(requestString, RequestType.AddFailed); break; case INVALID_MESSAGE: request = new StatusRequest(requestString, RequestType.InvalidMessage); break; case "contacts": request = new ContactListRequest(); break; } if (request.Type != RequestType.Empty) { return(request); } int splitterIndex = requestString.IndexOf(':'); string requetsType = requestString.Substring(0, splitterIndex); string requestBody = requestString.Substring(splitterIndex + 1); string[] requestParams = splitRequestBody(requestBody); switch (requetsType) { case "msg": request = new MessageRequest( requestParams[MessageRequest.TEXT], requestParams[MessageRequest.TO_LOGIN]); break; case "auth": request = new AuthRequest( requestParams[AuthRequest.LOGIN], requestParams[AuthRequest.PASSWORD]); break; case "add": request = new AddRequest( requestParams[AddRequest.LOGIN]); break; case "contact": request = new ContactRequest( requestParams[ContactRequest.NICKNAME], requestParams[ContactRequest.LOGIN]); break; case "reg": request = new RegisterRequest( requestParams[RegisterRequest.LOGIN], requestParams[RegisterRequest.PASSWORD], requestParams[RegisterRequest.NICKNAME]); break; } return(request); }
public List <Contacts> ContactList(ContactListRequest model) { return(CDAL.ContactList(model)); }