Is this code business logic or presentation logic?
Tag : chash , By : Santhanam
Date : March 29 2020, 07:55 AM
I hope this helps you . I'd produce a ViewModel that encapsulates this logic as a boolean DisplayContactInfo property. It depends on how "clean" you want your views.
|
I have a logic, I need the same logic to be written in a batch file (windows). Below is the code
Date : November 22 2020, 12:01 PM
hop of those help? As understood from you, you want to transfer 5 files into each folder. Which means, files 1 to 5 are put into folder 1, 6 to 10 in folder 2, 11 to 15 in folder 3 and so on. Try out this code, should work well with just one loop. @echo off
setlocal enabledelayedexpansion enableextensions
set total=45
set /a result=(total/num1)
set foldernum=0
FOR /L %%I IN (1,1,%total%) DO (
set /A var=%%I %% 5
if !var! == 1 (
set /A foldernum=foldernum + 1
)
ECHO %%I And !foldernum!
)
pause
|
How to set the HTTP status code to 201 using ServiceStack without mixing business logic with transport logic?
Date : March 29 2020, 07:55 AM
To fix this issue You could use an attribute on your create actions. This makes it clear the status the method will return while not being directly involved in the action logic itself. [AddHeader(HttpStatusCode.Created)]
public int Post(TestRequest request)
{
return 0; // Record Id
}
public interface ICreated
{
}
public class UserCreatedResponse : ICreated
{
public int Id { get; set; }
}
public class TestService : Service
{
public UserCreatedResponse Post(CreateUserRequest request)
{
return new UserCreatedResponse { Id = 123 };
}
}
public override void Configure(Funq.Container container)
{
GlobalResponseFilters.Add((req, res, obj) => {
var result = obj as ICreated;
if(result != null) {
res.StatusCode = (int)HttpStatusCode.Created;
res.StatusDescription = "Created";
}
});
}
[Route("/User","POST")]
public class CreateUserRequest : IReturn<UserCreatedResponse>
{
public string Name { get; set; }
public int Age { get; set; }
}
|
Which kind of logic code should be in Components? Which kind of logic code should be in Service?
Date : March 29 2020, 07:55 AM
this one helps. I think this is equivalent to asking: What is the role of Services within the context of the MVC pattern? In Angular2, the Model is the Object model, specified as member variables of the component class, the Controller is the Component class, and the View is the component template. Services are responsible for retrieving the Models that the Controller needs to render the view. Hence, Services are view agnostic.
|
Designing view in Interface Builder, but with some logic defined in code
Date : March 29 2020, 07:55 AM
|