/// <summary>
 /// 新增自選資料
 /// </summary>
 public async Task <Response <OptionalResponse> > CreateOptional(OptionalCreateRequest request)
 {
     using (IUnitOfWork uow = _unitOfWorkManager.Begin())
     {
         Optionals optional = new Optionals();
         optional.PriceID = request.PriceId;
         optional.Remark  = request.Remark;
         optional.Tag     = request.Tag;
         uow.BeginTransaction();
         int?id = uow.OptionalsRepository.Create(optional, uow.DbTransaction);
         if (id != null)
         {
             optional.OptionalID = (int)id;
             uow.Commit();
             Prices           price    = uow.PricesRepository.Get(optional.PriceID);
             OptionalResponse response = new OptionalResponse();
             response.PriceID               = price.PriceID;
             response.District              = price.District;
             response.TransactionSign       = price.TransactionSign;
             response.HouseNumberPlate      = price.HouseNumberPlate;
             response.AreaSquareMeter       = price.AreaSquareMeter;
             response.TransactionDate       = price.TransactionDate;
             response.TransactionNumber     = price.TransactionNumber;
             response.TotalFlorNumber       = price.TotalFlorNumber;
             response.BuildingState         = price.BuildingState;
             response.MainUse               = price.MainUse;
             response.MainBuildingMaterials = price.MainBuildingMaterials;
             response.CompleteDate          = price.CompleteDate;
             response.ShiftingTotalArea     = price.ShiftingTotalArea;
             response.Room                 = price.Room;
             response.Hall                 = price.Hall;
             response.Health               = price.Health;
             response.Compartmented        = price.Compartmented;
             response.ManageOrganization   = price.ManageOrganization;
             response.TotalPrices          = price.TotalPrices;
             response.UnitPrices           = price.UnitPrices;
             response.BerthCategory        = price.BerthCategory;
             response.BerthAreaSquareMeter = price.BerthAreaSquareMeter;
             response.BerthTotalPrices     = price.BerthTotalPrices;
             response.Note                 = price.Note;
             response.MainBuildingArea     = price.MainBuildingArea;
             response.OutbuildingArea      = price.OutbuildingArea;
             response.BalconyArea          = price.BalconyArea;
             response.Elevator             = price.Elevator;
             response.Remark               = request.Remark;
             response.Tag = request.Tag;
             return(new Response <OptionalResponse>(response, "success"));
         }
         uow.Rollback();
         return(new Response <OptionalResponse>("fail"));
     }
 }
 public async Task <IActionResult> CreateOptional([FromBody] OptionalCreateRequest request)
 {
     return(Ok(await _optionalService.CreateOptional(request)));
 }