Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The 'Reponse Dtos' seem unnecessary since ResponseStatus property is <a href="https://stackoverflow.com/questions/11750799/is-responsestatus-needed-in-servicestack">no longer needed.</a>. Though, I think you may still need a matching Response class if you use SOAP. If you remove the Response Dtos you no longer need to shove BookLimit into Response objects. Also, ServiceStack's TranslateTo() could help as well. </p> <p>Below is how I would try to simplify what you posted...YMMV.</p> <p>Make a DTO for BookingLimit - This will be the representation of BookingLimit to all other systems.</p> <pre><code>public class BookingLimitDto { public int Id { get; set; } public int ShiftId { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } public int Limit { get; set; } } </code></pre> <p>Requests and Dtos are <a href="https://stackoverflow.com/questions/10750571/getting-servicestack-to-retain-type-information/10759250#10759250">very important</a></p> <pre><code>[Route("/bookinglimit", "GET")] [Authenticate] public class GetBookingLimit : IReturn&lt;BookingLimitDto&gt; { public int Id { get; set; } } [Route("/bookinglimits", "GET")] [Authenticate] public class GetBookingLimits : IReturn&lt;List&lt;BookingLimitDto&gt;&gt; { public DateTime Date { get; set; } } </code></pre> <p>No longer returning Reponse objects...just the BookingLimitDto </p> <pre><code>public class BookingLimitService : AppServiceBase { public IValidator AddBookingLimitValidator { get; set; } public BookingLimitDto Get(GetBookingLimit request) { BookingLimitDto bookingLimit = new BookingLimitRepository().Get(request.Id); //May need to bookingLimit.TranslateTo&lt;BookingLimitDto&gt;() if BookingLimitRepository can't return BookingLimitDto return bookingLimit; } public List&lt;BookingLimitDto&gt; Get(GetBookingLimits request) { List&lt;BookingLimitDto&gt; bookingLimits = new BookingLimitRepository().GetByRestaurantId(base.UserSession.RestaurantId); return bookingLimits.Where( l =&gt; l.EndDate.ToShortDateString() == request.Date.ToShortDateString() &amp;&amp; l.StartDate.ToShortDateString() == request.Date.ToShortDateString()).ToList(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload