public IActionResult GetAuthors() // public IEnumerable<Author> Get() { var authors = Mapper.Map <IEnumerable <AuthorDto> >(Respository.GetAuthorList()); return(Ok(authors)); }
//public override void OnActivityCreated(Bundle savedInstanceState) //{ // base.OnActivityCreated(savedInstanceState); // DoWork(); //} private async void DoWork() { var pr = new Android.App.ProgressDialog(globalContext); pr.SetMessage("Loading data"); pr.SetCancelable(false); pr.Show(); var repository = new Respository(); //var channel = await await Task.Factory.StartNew(async() =>await repository.ReadPsi());//repository.ReadPsi(); //var channel = await await await Task.Factory.StartNew(() =>repository.ReadPsi().ContinueWith<Task<Channel>>(t=>t,TaskContinuationOptions.OnlyOnFaulted)); await Task.Factory.StartNew(() => BigLongImportantMethodAsync()); var channel = _channelResult; var psiInfo = PsiInformation.Parse(channel); var view = globalView; var foundTextbox = view.FindViewById <TextView>(Resource.Id.textViewUpdateTime); foundTextbox.Text = psiInfo.DisplayUpdateTime; foundTextbox = view.FindViewById <TextView>(Resource.Id.textView3hrPsi); foundTextbox.Text = psiInfo.Psi3Hour; foundTextbox = view.FindViewById <TextView>(Resource.Id.textView24hrPsi); foundTextbox.Text = psiInfo.Psi24Hour; var root = view.FindViewById <LinearLayout>(Resource.Id.linearLayoutRoot); root.Visibility = ViewStates.Visible; pr.Hide(); }
public void should_retrieve_existing_user() { User savedUser; using (var context = new DigitalHiveContext(_options)) { var repository = new Respository(context); User user = new User() { Username = "******", Password = "******", Role = "Manager" }; savedUser = repository.RegisterUser(user); } using (var context = new DigitalHiveContext(_options)) { var repository = new Respository(context); var result = repository.GetUser("existinguser"); Assert.AreEqual(result.ID, savedUser.ID, "Users do not match as expected"); } }
public AttributesController() { _attr = new Respository <Attributes>(); _atty = new Respository <AttributeType>(); _pro = new Respository <Product>(); _prat = new Respository <ProductAttr>(); }
public CartController() { _products = new Respository <Product>(); _attributes = new Respository <Project.Net.Models.DataModel.Attributes>(); _orders = new Respository <Order>(); _proAttr = new Respository <ProductAttr>(); }
public JsonTable GetSdLocalRefineryCompany(bool isEnglish, out string defaultCode) { var result = Respository.GetSdLocalRefineryCompany(isEnglish); defaultCode = result.Rows[0][0].ToString(); return(BuidJsonTable(result)); }
public GroupController() { _group = new Respository <Group>(); _business = new Respository <Business>(); _role = new Respository <Role>(); _groupRole = new Respository <GroupRoles>(); }
public OrderController() { _odr = new Respository <Order>(); _products = new Respository <Product>(); _orderDetails = new Respository <OrderDetails>(); _attributes = new Respository <Attributes>(); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { // check đăng nhập if (HttpContext.Current.Session["User"] == null) { return(false); } if (String.IsNullOrEmpty(this.Roles)) { return(true); } // lấy controller hiện tại var controller = HttpContext.Current.Request.RequestContext.RouteData.GetRequiredString("controller"); // lấy quyền người dùng Respository <GroupRoles> _groupRole = new Respository <GroupRoles>(); var _user = HttpContext.Current.Session["User"] as User; var _groupRoles = _groupRole.GetBy(x => x.GroupId == _user.GroupId); // check xem trong đó có quyền yêu cầu hay không if (!_groupRoles.Any(x => x.BusinessId == controller && x.RoleId == this.Roles)) { return(false); } return(true); }
static void Main(string[] args) { var respository = new Respository(); respository.GetAllPersons(1); respository.GetAllSongs(); }
public bool InertModel(SysRoleDto model) { model.CreateTime = DateTime.Now; model.Id = Guid.NewGuid(); var temp = Mapper.Map <SysRoleDto, SysRole>(model); return(Respository.Insert(temp) > 0 ? true : false); }
public ActionResult ExportOutputChartData() { var data = Respository.GetSDLocalRefinerExcelData(); var index = Respository.GetSDLocalRefineryExcelIndex(); var valuation = Respository.GetSDLocalRefineryExcelValuation(); var stock = Respository.GetSDLocalRefineryExcelStock(); return(new SDLRChartExcelResult(data, index, valuation, stock)); }
public IActionResult BlockAuthorAdd(int id) { if (Respository.AuthorExists(id)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } return(NotFound()); }
public void ShouldCrateDynamicQuery() { var query = "SELECT Id, DateOfBirth from Customer"; var rs = new Respository().Query(query); var sumId = rs.Select(x => (Int32)x.Id).Sum(); var birthDateOfType = rs.All(x => x.DateOfBirth is string); Assert.True(birthDateOfType); }
public ProductsController() { _product = new Respository <Product>(); _cat = new Respository <Category>(); _sup = new Respository <Supplier>(); _attr = new Respository <AttributeType>(); _prAttr = new Respository <ProductAttr>(); _note = new Respository <Note>(); _proNote = new Respository <ProductNote>(); _od = new Respository <OrderDetails>(); }
public ViewResult RsvpForm(GuestResponse guestResponse) { if (ModelState.IsValid) { Respository.AddResponse(guestResponse); return(View("Thanks", guestResponse)); } else { return(View()); } }
public ActionResult GetSDLocalRefineryChartData(DateTime start, DateTime end, bool isHTML = false) { var result = Respository.GetSDLocalRefineryChartData(); string defaultCode; var companyList = GetSdLocalRefineryCompany(CultureHelper.IsEnglishCulture(), out defaultCode); string reDate; var dailyOutputTable = ConvertToDicForOutput(start, end, defaultCode, out reDate); var deviceInfoTable = ConvertToDicForDevice(CultureHelper.IsEnglishCulture(), defaultCode, reDate); var data = new { chart = result, companyList, deviceInfoTable, dailyOutputTable, reDate }; return(isHTML ? Json(data, "text/html", JsonRequestBehavior.AllowGet) : Json(data, JsonRequestBehavior.AllowGet)); }
// public string Get(int id) // { // return "value"; // } public IActionResult GetAuthor(int id) { var author = Respository.GetAuthor(id); if (author == null) { return(NotFound()); // 404 } var authorDto = Mapper.Map <AuthorDto>(author); return(Ok(authorDto)); }
public AccountType(Respository repo) { Name = "Account"; Description = "Account information of a person"; Field(d => d.AccountId); Field(d => d.Address); Field(d => d.Name); Field(d => d.Country); Field(d => d.Email); Field(d => d.HomeBranchId); Field<BranchType>("BranchDetail", resolve: context => repo.GetBranchByBranchId(context.Source.HomeBranchId)); }
public void ShoudCreateSchema() { var customer = new Customer { FirstName = "wk", LastName = "wk", DateOfBirth = DateTime.Now }; var context = new Respository(); var id = context.SaveCustomers(customer); Assert.True(id > 0); }
public IActionResult GetBooksForAuthor(int authorId) { if (!Respository.AuthorExists(authorId)) { return(NotFound()); } var booksFromRepo = Respository.GetBookList(authorId); var booksForAuthor = Mapper.Map <IEnumerable <BookDto> >(booksFromRepo); return(Ok(booksForAuthor)); }
public List <TaskDTO> GetTasks() { try { var tasks = Respository.Tasks(); return(tasks); } catch (Exception exception) { //log Exception } return(new List <TaskDTO>()); }
public BranchType(Respository repo) { Name = "Branch"; Description = "Branch related information"; Field(d => d.BranchId); Field(d => d.Address); Field(d => d.BranchCode); Field(d => d.Country); Field <ListGraphType <AccountType> >( "AccountDetails", resolve: context => repo.GetAccountByBranchId(context.Source.BranchId)); }
private async void BigLongImportantMethodAsync() { var repository = new Respository(); try { _channelResult = await repository.ReadPsi(); } catch (Exception ex) { throw ex; } }
public IActionResult GetAuthorCollection(string ids) // public IActionResult GetAuthorCollection(IEnumerable<int> ids) // Custom Model Binder - Nah -- very complicated, see Demo - Working with Array Keys { var idList = StringHelper.StringToIntegerList(ids); var authorList = Respository.GetAuthors(idList); if (idList.Count() != authorList.Count()) { return(NotFound()); } return(Ok(Mapper.Map <IEnumerable <AuthorDto> >(authorList))); }
public static List <Prestamos> GetList(Expression <Func <Prestamos, bool> > criterio) { using (var context = new Respository <Prestamos>()) { try { return(context.GetList(criterio)); } catch (Exception) { throw; } } }
public static List <Prestamos> GetListAll() { using (var context = new Respository <Prestamos>()) { try { return(context.GetListAll()); } catch (Exception) { throw; } } }
public static Productos Buscar(Expression <Func <Productos, bool> > criterio) { using (var context = new Respository <Productos>()) { try { return(context.Buscar(criterio)); } catch (Exception) { throw; } } }
public static bool Eliminar(Prestamos prestamos) { using (var context = new Respository <Prestamos>()) { try { return(context.Eliminar(prestamos)); } catch (Exception) { throw; } } }
public static bool Modificar(Productos producto) { using (var context = new Respository <Productos>()) { try { return(context.Modificar(producto)); } catch (Exception) { throw; } } }