123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
-
- using System;
- using System.Collections.Generic;
- using System.ComponentModel.DataAnnotations;
- using System.Data;
- using System.Data.Entity;
- using System.Data.Entity.Infrastructure;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web;
- using System.Web.Http;
- using System.Web.Http.Description;
- using System.Web.Http.OData;
- using iBemsDataService;
- using iBemsDataService.Model;
- namespace iBemsDataService.Controllers
- {
- public class FmsBudgetDetailExecutionExController : ODataController
- {
- private iBemsEntities db = new iBemsEntities();
- // GET: odata/FmsEquipmentEx
- [Queryable]
- public List<FmsBudgetDetailExecutionEx> GetFmsBudgetDetailExecutionEx()
- {
- // 2019.07.12
- Uri uri = Request.RequestUri;
- var uriQuery = HttpUtility.ParseQueryString(uri.Query);
- int siteId;
- if (int.TryParse(uriQuery.Get("SiteId"), out siteId) == false)
- {
- throw new Exception("Not Found Parameters.");
- }
- var query = (
- from d in db.FmsBudgetDetailExecution.Where(x => x.SiteId == siteId)
- group d by new { d.SiteId, d.Year, d.Month } into grp
- select new FmsBudgetDetailExecutionEx
- {
- SiteId = grp.Key.SiteId,
- Year = grp.Key.Year,
- Month = grp.Key.Month
- });
- return query.ToList();
- }
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- db.Dispose();
- }
- base.Dispose(disposing);
- }
- }
- public class FmsBudgetDetailExecutionEx
- {
- public int SiteId { get; set; }
- public int Year { get; set; }
- public int Month { get; set; }
- }
- }
|